GeoFlutterFire
GeoFlutterFire copied to clipboard
How to obtain a list of geopoints only once?
My intend is to use GeoFlutterFire to obtain a list of places within certain radius and then use Firebase Database to obtain the rest of the data so I want to fetch this places list only once hence I don't want the Stream. Can anyone give me an example of how to complete this, please?
The way I did it was have the subscription cancel once it fetched all the data. https://gist.github.com/mikeyyg96/db3facc147981917d43945e2e4ff82a6
The way I did it was have the subscription cancel once it fetched all the data. https://gist.github.com/mikeyyg96/db3facc147981917d43945e2e4ff82a6
Can you post some example code here, please? Thanks in advance!
Check the link I posted. I can't put code here it messes up the formatting.
Check the link I posted. I can't put code here it messes up the formatting.
hmm, the link leads me to https://github.com/DarshanGowda0/GeoFlutterFire/issues/url and the page says:
No results matched your search. You could search all of GitHub or try an advanced search.
`subscription = radiusRX.switchMap((rad) { return _geoflutterfire.collection(collectionRef: queryRef).within( center: center, radius: rad, field: field, strictMode: true); }).listen((List<DocumentSnapshot> documentList) { Future.forEach(documentList, (DocumentSnapshot document) { // Fetches the data in the snapshot
}).whenComplete((){ // When it is finished fetching all the data, cancel subscription subscription.cancel(); });` Well here's the code even though it's badly formatted.
Tnx @mikeyyg96 I'll give it a try!
@mikeyyg96 what is radiusRX ?
This seems duplicate to https://github.com/DarshanGowda0/GeoFlutterFire/issues/27