kosukesaigusa / geoflutterfire_plus

🌍💙🔥 geoflutterfire_plus allows your flutter apps to query geographic data saved in Cloud Firestore. This package is fork from GeoFlutterFire, and tried to be constantly maintained to work with latest Flutter SDK, Dart SDK, and other dependency packages.
https://pub.dev/packages/geoflutterfire_plus
MIT License
57 stars 7 forks source link

QueryBuilder not returning any results #188

Closed stefandric closed 3 months ago

stefandric commented 4 months ago

geoflutterfire_plus: ^0.0.21

When trying to inject additional query, I am not getting any results. When removing queryBuilder, I am getting all results.

Code:

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .subscribeWithin(
            center: center,
            radiusInKm: radiusInKm,
            field: field,
            geopointFrom: geopointFrom,
            queryBuilder: (query) => query.where('archived', isEqualTo: false),
          )
          .first;

  final obj =
      res.map((docSnapshot) => Post.fromDocumentSnapshot(docSnapshot)).toList();

  return obj;

nor with fetchWithin

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .fetchWithin(
    center: center,
    radiusInKm: radiusInKm,
    field: field,
    geopointFrom: geopointFrom,
    queryBuilder: (query) => query.where('archived', isEqualTo: false),
  );

i've tested it further because i thought it is something with my query, but passing null to query doesn't also work(I saw an example proj where null should get all values as well).

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .fetchWithin(
    center: center,
    radiusInKm: radiusInKm,
    field: field,
    geopointFrom: geopointFrom,
    queryBuilder: (query) => null,
  );
stefandric commented 4 months ago

@kosukesaigusa any update on this?

kosukesaigusa commented 4 months ago

@stefandric

Thank you for your comment and, sorry for my late reply!

May I ask you you have set necessary index on Cloud Firestore to execute the query?

https://github.com/kosukesaigusa/geoflutterfire_plus?tab=readme-ov-file#custom-query-conditions

000038@2x