GeoFlutterFire
GeoFlutterFire copied to clipboard
Will this plugin get the same "closest" filter, like GeoFireX?
Hi,
I saw that GeoFireX has a closest() option, which sounds like a great substitute for limit().
Will this plugin support closest() at some point?
Thanks, Jonas
(source, described here: https://fireship.io/lessons/geolocation-query-in-firestore-realtime/ )
The closest is in the position 0 of the DocumentSnapshot list.
Query ref = FirebaseFirestore.instance
.collection('SomeCollection');
GeoFirePoint center = geo.point(latitude: latitude, longitude: longitude);
subscription = radius.switchMap((rad) {
return geo.collection(collectionRef: ref).within(
center: center, radius: rad, field: 'position', strictMode: true);
}).listen((List<DocumentSnapshot> documentList) {
print(documentList[0]); //this one is the closest
});
}