I have been updating my libraries and flutter version, where I got this error for Geoflutterfire. It says in the documentation that it is possible to use a Query instead of a CollectionReference. The Widget Geoflutterfire require a type of CollectionReference, which the query is use is not.
final geo = Geoflutterfire();
final center = geo.point(latitude: MyApp.userLocation.latitude!,longitude: MyApp.userLocation.longitude!);
FirebaseFirestore _firestore = FirebaseFirestore.instance;
var queryRef = await _firestore
.collection(COLLECTION_JOB)
.where(IS_ACTIVE, isEqualTo: true)
.where(IS_DELETED, isEqualTo: false);
var stream = await geo
.collection(collectionRef: queryRef)
.within(center: center, radius: NEARBY_JOB_DISTANCE, field: GEO_HASH);
In the above code my collectionRef: queryRef won't run as I get this error: "The argument type 'Query<Map<String, dynamic>>' can't be assigned to the parameter type 'CollectionReference<Object?"
It is a simple problem and I tried to change the type to var instead of Query, where the code ran and gave me this error: "E/flutter (30258): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type '_JsonQuery' is not a subtype of type 'CollectionReference<Object?>' E/flutter (30258): #0 getGeoHashQuery (package:Hyree/data/firestore/queries.dart:33:34)"
I hope you can help me as the documentation says it is possible: https://github.com/awaik/GeoFlutterFire Under the chapter: Scale to Massive Collections
From looking at the current reference documentation and code of the
DarshanGowda0 / GeoFlutterFirelibrary itscollectionmethod only accepts aCollectionReferenceand not a query.It seems the documentation stating otherwise is wrong here, so you might want to file a bug for that.