GeoFlutterFire icon indicating copy to clipboard operation
GeoFlutterFire copied to clipboard

Error when using Query and CollectionReference

Open bilalsammour opened this issue 3 years ago • 9 comments

When using the example in the documentation:

var queryRef = _firestore.collection('locations').where('city', isEqualTo: 'bangalore');
var stream = geo
              .collection(collectionRef: queryRef)
              .within(center: center, radius: rad, field: 'position');

I get this error: The argument type 'Query<Object?>' can't be assigned to the parameter type 'CollectionReference<Object?>'.dartargument_type_not_assignable.

I tried to downgrade but nothing worked.

bilalsammour avatar Jan 27 '22 06:01 bilalsammour

I've the same problem and I don't know why. Before It worked perfectly but I did an update and it's broken. I hope some people had this and can resolved it.

Edit : I downgraded Cloud_firestore to 2.5.4 and GeoFlutterFire to 3.0.1 and It works

Simats13 avatar Feb 02 '22 10:02 Simats13

I'm facing the same issue.

pradeep-spikey-tech avatar Feb 10 '22 10:02 pradeep-spikey-tech

The downgrade worked for me. Hoping for a fix at some point though too.

mellowcello77 avatar Feb 10 '22 10:02 mellowcello77

After upgrading the version of cloud firestore (was 2.5.3), this started to happen for me as well

rafaelpbrasil avatar Feb 16 '22 15:02 rafaelpbrasil

I also get the same error. I'm using Firestore collection with "where" query. Here is the error: type '_JsonQuery' is not a subtype of type 'CollectionReference<Object?>' in type cast

ShohidulProgrammer avatar Feb 20 '22 17:02 ShohidulProgrammer

I Downgrade to cloud_firestore: ^2.3.0 and geoflutterfire: ^3.0.1, and now it´s working.

rimedar avatar Mar 15 '22 15:03 rimedar

Off course we are going to be stuck on Firestore 2.5.4, and we are already on 3.1.10. I am not sure how we can tackle this fix.

mellowcello77 avatar Mar 20 '22 23:03 mellowcello77

Using the latest version (3.0.3) the error doens't happen anymore, the only adjustment that i needed to make is to explicitly give a type for the Query (Query<Map<String, dynamic>>).

rafaelpbrasil avatar Mar 30 '22 13:03 rafaelpbrasil

I can confirm Daimioo's comment as correct. Great news thank you for letting us know. Just updated and working as it should.
(I also noticed "distance" change to "kmDistance" in my method)

mellowcello77 avatar Mar 30 '22 14:03 mellowcello77