I want to use geoflutterfire to get a collection of locations near my map centre.
https://pub.dev/packages/geoflutterfire
This package assumes you have a Geohash string for every lat/long. Querying a prefix of the Geohash is a very fast, efficient way to return a set of documents that are within a certain geographical range of the map location.
Now I'm trying to figure out how to integrate this into my project.
I'll need a cloud function to create Geohash values for all 6000 of my existing lat/long geopoints. For this I'll need to use geofire-common.
Then I'll need a custom action to get a firestore query collection that filters documents by Geohash prefix (depending on zoom) as well as by my choice chip keyword selection.
Using GeoFlutterFire the code might look something like this:
...
GeoFirePoint center = GeoFirePoint(latitude, longitude);
GeoFirestore geoFirestore = GeoFirestore(FirebaseFirestore.instance);
var query = geoFirestore.collection('your_collection').within(center: center, radius: radius, field: 'location');
QuerySnapshot<Map<String, dynamic>> snapshot = await query.get();
...
Now I'm trying to figure out how I "attach" this query collection custom action to my flutterflow page or widget so that it can be accessed in child widgets? Is this possible? Or should I call the custom action from inside a custom widget? (in this case a custom Google Map widget)