GeoFlutterFire icon indicating copy to clipboard operation
GeoFlutterFire copied to clipboard

How to obtain a list of geopoints only once?

Open i6x86 opened this issue 5 years ago • 8 comments

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?

i6x86 avatar Aug 19 '19 14:08 i6x86

The way I did it was have the subscription cancel once it fetched all the data. https://gist.github.com/mikeyyg96/db3facc147981917d43945e2e4ff82a6

mike-gallego avatar Aug 20 '19 20:08 mike-gallego

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!

i6x86 avatar Aug 21 '19 12:08 i6x86

Check the link I posted. I can't put code here it messes up the formatting.

mike-gallego avatar Aug 21 '19 12:08 mike-gallego

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.

i6x86 avatar Aug 21 '19 14:08 i6x86

`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.

mike-gallego avatar Aug 21 '19 14:08 mike-gallego

Tnx @mikeyyg96 I'll give it a try!

i6x86 avatar Aug 21 '19 14:08 i6x86

@mikeyyg96 what is radiusRX ?

klaszlo8207 avatar Aug 29 '19 07:08 klaszlo8207

This seems duplicate to https://github.com/DarshanGowda0/GeoFlutterFire/issues/27

MartinJLee avatar May 23 '20 09:05 MartinJLee