'Flutter FirebaseFirestore Listener
i have a small question about firebase firestore listener in flutter.
Let's say:
I have a document inside collection called "Test" and there is an array field called (ids = ["id1","id2"]) inside one or more documents in that collection. In flutter i have an FirebaseFirestore listener like that:
FirebaseFirestore.instance.collection("Test").where("ids",arrayContains:"id1")
.snapshots().listen((event) {
print("Something changed");
});
So, from the code above we know that any changes happened to any documents that contains "id1" in ids field will fire the listener and print "Something changed".
My problem is that when "id1" removed from ids field in any document the listener stop listening to that document directly without fire at least once so i can update for example something stored in shared preferences.
Is there a way to fire at least once ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
