You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My problem is that the stream doesn't update when my cloud function changes a field in a document eg("isViewed": true/false)
If however the document is updated by a flutter .update({"isViewed": true/false}) function, then the stream updates properly.
Here is my code:
void getTaxiStream() async {
final geo = Geoflutterfire();
String field = 'location';
//Get the max radius from my Firebase config document
DocumentSnapshot<Map<String, dynamic>> radiusGetter = await FirebaseFirestore.instance.collection('config').doc('searchParams').get();
maxRadius = radiusGetter.get('radius').toDouble();
GeoFirePoint center = geo.point(latitude: widget.startPlace.coords.latitude, longitude: widget.startPlace.coords.longitude);
var collectionReference = FirebaseFirestore.instance
.collection('driver')
.where('status', isEqualTo: 'ready')
.where('isViewed', isEqualTo: false);
//checking if a Listener is already running
if(taxiListener == null) {
Stream<List<DocumentSnapshot>> stream = geo
.collection(collectionRef: collectionReference)
.within(center: center, radius: maxRadius, field: field, strictMode: false);
taxiListener = stream.listen((avblDriver) {
//MY_CODE
});
} else {
getTaxiList(nearestDriver);
}
}
Here is a snip of my Firestore:
I hope someone can help me with this problem. Since it is hard to explain on github, it would also be possible for me to meet on discord for further explanation.
Cheers Andre
The text was updated successfully, but these errors were encountered:
@andidago This seems like a question about Flutter and Firebase then it is about GeoFlutter. Take a look at this example in the FireFlutter project to see how to handle updates based on database changes on the server:
Hello,
first of all thanks for the nice package!
My problem is that the stream doesn't update when my cloud function changes a field in a document eg("isViewed": true/false)
If however the document is updated by a flutter .update({"isViewed": true/false}) function, then the stream updates properly.
Here is my code:
Here is a snip of my Firestore:
I hope someone can help me with this problem. Since it is hard to explain on github, it would also be possible for me to meet on discord for further explanation.
Cheers Andre
The text was updated successfully, but these errors were encountered: