我一直在更新我的庫和顫振版本,在那里我得到了 Geoflutterfire 的這個錯誤。它在檔案中說可以使用 Query 而不是 CollectionReference。Widget Geoflutterfire 需要一種 CollectionReference 型別,而查詢使用的型別不是。
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);
在上面的代碼中,我的 collectionRef: queryRef 不會運行,因為我收到此錯誤:“引數型別 'Query<Map<String, dynamic>>' 不能分配給引數型別 'CollectionReference<Object?”
這是一個簡單的問題,我嘗試將型別更改為var而不是Query,代碼運行并給了我這個錯誤:“E/flutter (30258): [ERROR:flutter/lib/ui/ui_dart_state.cc(209 )] 未處理的例外:'_JsonQuery' 型別不是'CollectionReference<Object?>' 型別的子型別 E/flutter (30258): #0 getGeoHashQuery (package:Hyree/data/firestore/queries.dart:33:34)"
我希望你能幫助我,因為檔案說這是可能的: https ://github.com/awaik/GeoFlutterFire 在章節下:擴展到海量收藏
uj5u.com熱心網友回復:
答案是將 GeoFlutterFire 的版本降級到 3.0.1 版,將 Cloud Firestore 降級到 2.5.4 版。
uj5u.com熱心網友回復:
通過查看庫的當前參考檔案和代碼,DarshanGowda0 / GeoFlutterFire它的collection方法只接受CollectionReference查詢而不接受查詢。
此處的檔案似乎另有說明是錯誤的,因此您可能需要為此提交錯誤。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/421799.html
標籤:
上一篇:如何在發布模式下查看日志?
下一篇:在顫振中創建一個全域浮動按鈕
