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

Not getting any Documents from Firestore #42

Closed sabeaussan closed 5 years ago

sabeaussan commented 5 years ago

Hi @DarshanGowda0,

I'm currently trying to implement GeoFlutterFire in an app. I can write without any issue but when trying to get Documents from Firestore it always return an empty list.

Here's my code for getting data :

GeoFirePoint center = db.geoflutterfire.point(latitude : 40.4251669 , longitude : -3.7098554); var init = Firestore.instance.collection("Tags"); db.geoflutterfire.collection(collectionRef: init).within( strictMode: false, center: center, field: "position", radius: 2, ).listen(_onNewTagsSnapshot);

The call back :

void _onNewTagsSnapshot(List<DocumentSnapshot> snapshot){ print("_onNewTagsSnapshot TRIGGERED *************"+snapshot.toString()); _listTagsControllerSink.add(snapshot); }

which always print an empty list even thought I have 4 documents corresponding to the query.

Here is how the database look like.

screenshot_tag

What Am I missing ? Thanks in advance. Best regards.

netwiser commented 5 years ago

Hi @sabeaussan , what was your solution? I am having a similar issue now, can't get anything out from Firestore.

TaifRaoof commented 5 years ago

Hi this problem also appear to me now, so how to solve it ? any help.

sabeaussan commented 5 years ago

Hi guys,

Sorry for the delay in my answer. My issue was just a typo. I mistakenly added an extra whitespace at the end of the name of the field "position". So in firestore the field was named "position " and in my code I was querying "position" without the extra space so no documents was getting returned.

Don't know if it helps.

Best regards

TaifRaoof commented 5 years ago

i think when i change the value of geohash to any other random string the document disappear when i make a query so i change the value of geohash to start with "svx" only work for me. so i think this is the problem.