DarshanGowda0 / GeoFlutterFire

:fire:GeoFlutterFire:fire: is an open-source library that allows you to store and query firestore documents based on their geographic location.
https://youtu.be/MYHVyl-juUk
MIT License
305 stars 261 forks source link

Fetching map data from a collection and displaying using GeoFlutterFire #77

Open aayush-srivastava opened 4 years ago

aayush-srivastava commented 4 years ago

Hi @DarshanGowda0 ,

I am trying to fetch marker locations from a firebase collection and display them on a map but am confused as to how to implement this by solely relying on the documentation of GeoFlutterFire.

So far as per the documentation I have used the following code:

Firestore _firestore = Firestore.instance;
Geoflutterfire geo = Geoflutterfire();    

GeoFirePoint center = geo.point(latitude: currentLocation.latitude, longitude: currentLocation.longitude); // get the collection reference or query var collectionReference = _firestore.collection('locations'); double radius = 5; String field = 'position'; Stream<List> stream = geo.collection(collectionRef: collectionReference) .within(center: center, radius: radius, field: field);

stream.listen((List<DocumentSnapshot> documentList){
    //DO NOT KNOW WHAT TO WRITE HERE TO IMPLEMENT THE SAME
});

I am relatively new to the flutter framework so would appreciate any help.

saipavankumar-muppalaneni commented 4 years ago

did u find any solutions, because I am stuck at the same place for days?