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

Geoflutterfire with where statement #103

Open zpawlo02 opened 4 years ago

zpawlo02 commented 4 years ago

So when I'm trying to put ref like this: var q = _firestore.collection('users').where('age', isGreaterThanOrEqualTo: minAge).where('age', isLessThanOrEqualTo: maxAge); to:

Geoflutterfire geo = Geoflutterfire();
return geo.collection(collectionRef: q)
        .within(center: center, radius: radius, field: 'position');

I'm getting this error:

_Unhandled Exception: PlatformException(invalid_query, FIRInvalidArgumentException, Invalid query. You have a where filter with an inequality (lessThan, lessThanOrEqual, greaterThan, or greaterThanOrEqual) on field 'age' and so you must also use 'age' as your first queryOrderedBy field, but your first queryOrderedBy is currently on field 'position.geohash' instead.)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
<asynchronous suspension>
#2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#3      MethodChannelQuery.snapshots.<anonymous closure> (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart:55:50)
#4      _runGuarded (dart:async/stream_controller.dart:823:24)
#5      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_contr<…>_
ghost commented 4 years ago

isGreaterThanOrEqualTo and isLessThanOrEqualTo appears to not work at all.