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

hi, where not work #25

Closed gustavobrian closed 5 years ago

gustavobrian commented 5 years ago

hi, thank for your works!! do you like help me?

-------- WORK PERFECT ---------------- var collectionReference = Firestore.instance.collection('userBasic').where('provider', isEqualTo: false).where('ispublic', isEqualTo: true); var acata = await collectionReference.getDocuments();

--------WORK PERFECT---------------- stream = radius.switchMap((rad) { var collectionReference = Firestore.instance.collection('userBasic')

  print('rad');
  return geo.collection(collectionRef: collectionReference).within(
        center: center,
        radius: rad,
        //strictMode: true,
        field: 'geoFirePoint',
      );
});

--------NOT WORK , NOT RETURN ---------------- stream = radius.switchMap((rad) { var collectionReference = Firestore.instance.collection('userBasic').where('provider', isEqualTo: false).where('ispublic', isEqualTo: true);

  print('rad');
  return geo.collection(collectionRef: collectionReference).within(
        center: center,
        radius: rad,
        //strictMode: true,
        field: 'geoFirePoint',
      );
});
felpsio commented 5 years ago

You wrote half of the code needed. It should work something like this:

Stream<List<DocumentSnapshot>> stream = geo.collection(collectionRef: ref)
  .within(center: center, radius: rad, field: 'geoFirePoint');

stream.listen((List<DocumentSnapshot> documentList) {
  //do something
}
gustavobrian commented 5 years ago

hi felipe:

test() async { var collectionReference = await Firestore.instance.collection('userBasic').where('provider', isEqualTo: true).getDocuments(); print(collectionReference.toString()); }

test() WORK! Next not Work pd: if remove '.where('provider', isEqualTo: true)' from collection reference in geo.collection work ok!!

var collectionReference = Firestore.instance.collection('userBasic').where('provider', isEqualTo: true); GeoFirePoint center = geo.point(latitude: _geoFirePointProvider.latitude, longitude: _geoFirePointProvider.longitude); double radius1 = 50; String field = 'geoFirePoint'; Stream<List> stream1 = geo.collection(collectionRef: collectionReference).within(center: center, radius: radius1, field: field);

stream1.listen((List<DocumentSnapshot> documentList) {
  print(documentList.toString());
});
gustavobrian commented 5 years ago

hello, any solution? // Collection ref // var collectionReference = _firestore.collection('locations').where('city', isEqualTo: 'bangalore'); var collectionReference = _firestore.collection('locations'); var geoRef = geo.collection(collectionRef: collectionReference);

collectionReference not work with "where"

firebase_core: ^0.3.4 geoflutterfire: git: https://github.com/felipecesar42/GeoFlutterFire.git

Thanks!!!

felpsio commented 5 years ago

@gustavobrian You should use the last version of this library, not my version. The change I made it's already pushed to the repository. So my version is not needed anymore.

Firestore have lots of query limitations right now. You should study a little its limitations: https://firebase.google.com/docs/firestore/query-data/queries.

Your problem is probably not related to the library. You can try to post your problem in a detailed way in StackOverflow.

Anyway... try to debug your app and understand what is the exception thrown. Many problems related to the firebase gets a detailed explanation on the exception

gustavobrian commented 5 years ago

thanks felipe cesar... the error is the debug not show create index... I create manually index: provider Ascendente geoFirePoint.geohash Ascendente

and work...

THANKS!!! happy code!

felpsio commented 5 years ago

Cool @gustavobrian. I’m glad that I could help. Happy code bro

felpsio commented 5 years ago

By the way... you should close this issue

DarshanGowda0 commented 5 years ago

Thanks @felipecesar42 😄