【发布时间】:2020-07-25 10:48:35
【问题描述】:
我正在使用 GeoFlutterFire,这是一个用于查询附近用户位置的包。
这是我的代码。
Future<Stream<List<DocumentSnapshot>>> getUsers() async {
GeoFirePoint center = geo.point(latitude: lat, longitude: long);
var collectionref = Firestore.instance.collection("locations");
double radius = 50;
String field = 'position';
Stream<List<DocumentSnapshot>> stream = geo.collection(collectionRef: collectionref).within(center: center, radius: radius, field: field);
stream.forEach((element) {print(element);});
}
我在控制台打印了这个
[Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot', Instance of 'DocumentSnapshot']
我尝试了一切,但没有任何结果。
我也尝试从函数中返回Stream,但没有成功。
请帮忙。
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore