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

Where condition not working, without that plugin is not usefull , please fix asap. #132

Closed krsolutions closed 3 years ago

krsolutions commented 3 years ago

Where condition not working, without that plugin is not usefull , please fix asap.

luantrasel commented 3 years ago

it is working for me on version 2.2.1

you just need to add the where condition in the query that you pass to the collectionRef parameter

final collection = FirebaseFirestore.instance
        .collection('locations')
        .where('city', isEqualTo: 'San Francisco');

    Stream<List<DocumentSnapshot>> stream = Geoflutterfire()
        .collection(collectionRef: collection)
        .within(
            center: GeoFirePoint(40.7651, -73.9692633),
            radius: 40,
            field: 'location');
krsolutions commented 3 years ago

We need to register a composite query to make it work, for example, if there are filters like brands, size, gender...etc

we need to create an index for all combinations Nike, xl, male & puma, l, female ..etc

awaik commented 3 years ago

@krsolutions Have you solved this issue?

huangkaichang commented 3 years ago

Solved the issue too by adding a composite query. https://github.com/DarshanGowda0/GeoFlutterFire/issues/99#issuecomment-778756666