I'm using GeoFlutterFire, a plugin for Flutter which sifts a collection for records that are near a specified GeoFirePoint.
A distance key is supposed to be returned with the Firestore <DocumentSnapshot>s
but none is, only the default keys. When I seek it as below it returns null. The key doesn't exist.
- I've tried changing the emulators GPS location, and then the usersAddressGeoFirePoint, no luck.
- The instructions aren't clear on whether GeoFire creates this field, or needs it to pre-exist as a Firestore field. I've tried creating the Firestore field manually with a dummy value and then the value I get from the download is not the distance between the 2
geopoint
points but the dummy value it was set on Firestore.
This is great frustration, I need the distance so I can show it on Cards in the app, my code is very close to the example code for the plugin, so I can't see why it doesn't work.
GeoFirePoint usersAddressGeoFirePoint =
geo.point(latitude: 56.088944, longitude: -4.151800);
localJobsStream = geo.collection(collectionRef: myFirestore.collection('JobsMeta'))
.within(center: usersAddressGeoFirePoint, radius: 1000, field: 'position', strictMode: true);
localJobsStream.listen((List<DocumentSnapshot> documentList) {
${documentList[0].data.keys.contains('distance')}");
}