flutter:如何从 firestore 读取 geohash 和 geopoint

flutter: how to read geohash and geopoint from firestore

以下是我在firestore中保存用户geohashgeopoint的方法

比如我要读取字段intro,我这样写;

FirebaseFirestore.instance.collection('...').doc(..).data()['intro']

但我不知道如何从 firestore 读取 geohashgeopointgeohash 在地图内部,geopoint 是地图内部的数组。你如何从我的 firestore 中检索 geohashgeopoint

您可以读取 g 而不是返回 intro 字段并将数据转换为 JSON。例如:

var location = FirebaseFirestore.instance.collection('...').doc(..).data()['g']
location = jsonEncode(location.toJson())