flutter:如何从 firestore 读取 geohash 和 geopoint
flutter: how to read geohash and geopoint from firestore
以下是我在firestore中保存用户geohash
和geopoint
的方法
比如我要读取字段intro
,我这样写;
FirebaseFirestore.instance.collection('...').doc(..).data()['intro']
但我不知道如何从 firestore 读取 geohash
和 geopoint
。 geohash
在地图内部,geopoint
是地图内部的数组。你如何从我的 firestore 中检索 geohash
和 geopoint
?
您可以读取 g
而不是返回 intro
字段并将数据转换为 JSON。例如:
var location = FirebaseFirestore.instance.collection('...').doc(..).data()['g']
location = jsonEncode(location.toJson())
以下是我在firestore中保存用户geohash
和geopoint
的方法
比如我要读取字段intro
,我这样写;
FirebaseFirestore.instance.collection('...').doc(..).data()['intro']
但我不知道如何从 firestore 读取 geohash
和 geopoint
。 geohash
在地图内部,geopoint
是地图内部的数组。你如何从我的 firestore 中检索 geohash
和 geopoint
?
您可以读取 g
而不是返回 intro
字段并将数据转换为 JSON。例如:
var location = FirebaseFirestore.instance.collection('...').doc(..).data()['g']
location = jsonEncode(location.toJson())