Closed
Description
Describe the bug
The List.compare()
method always returns false when comparing a DocumentReference
with List<DocumentReference>
. This bug doesn't produce an error in console, but it's effects are visible when certain code can't be reached.
This bug exists in cloud_firestore: 0.13.0
and above.
This bug doesn't exist in cloud_firestore: 0.12.11
.
To Reproduce
Steps to reproduce the behavior:
- Create a
List<DocumentReference>
from firestore data. - Pass a valid
DocumentReference
into theList.contains()
method.
List<DocumentReference> favorites = List.from(userDocument['favorites']);
if (favorites.contains(documentReference)) {
// This is never reached
}
- The
List.contains()
method always returns false, even if the list contains theDocumentReference
. There is no error thrown.
Expected behavior
The List.compare()
method should return true if the List<DocumentReference>
contains the passed DocumentReference
. It should only return false if the List doesn't contain the DocumentReference
.
Additional context
Firebase versions:
firebase_core: ^0.4.4
cloud_firestore: ^0.13.2+2
Flutter doctor:
[√] Flutter (Channel beta, v1.14.6, on Microsoft Windows [Version 10.0.18362.657], locale en-GB)
• Flutter version 1.14.6 at C:\src\flutter
• Framework revision fabeb2a16f (3 weeks ago), 2020-01-28 07:56:51 -0800
• Engine revision c4229bfbba
• Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\stuie\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)