Firebase 如何在Firestore中为文档添加地理点、时间戳和引用
在Firestore中设置基本类型相当简单 但我找不到如何使用FlatterFireStore插件构建Geopoint、Timestamp和另一个文档引用Firebase 如何在Firestore中为文档添加地理点、时间戳和引用,firebase,google-cloud-firestore,flutter,Firebase,Google Cloud Firestore,Flutter,在Firestore中设置基本类型相当简单 但我找不到如何使用FlatterFireStore插件构建Geopoint、Timestamp和另一个文档引用 new GeoPoint(longitude: 3.4, latitude: 4.5) }) 为每个对象设置为CoolRectionMap的内部数据是什么 有任何帮助或示例吗?我在服务器上手动创建了一个对象,并将其放入我的Flatter应用程序中。 对于时间戳,您可以直接从dart传递DateTime对象 对于Geopoint,Fires
new GeoPoint(longitude: 3.4, latitude: 4.5) })
为每个对象设置为CoolRectionMap
的内部数据是什么
有任何帮助或示例吗?我在服务器上手动创建了一个对象,并将其放入我的Flatter应用程序中。 对于时间戳,您可以直接从dart传递
DateTime
对象
对于Geopoint,Firestore插件中有Geopoint对象
new GeoPoint(longitude: 3.4, latitude: 4.5) })
对于另一个文档引用,将作为值检索的
DocumentReference
传递给数据对象 在最新版本的颤振中,将创建一个没有命名参数的地质点
GeoPoint(0, 0);
第一个参数=>纬度
第二个参数=>经度要在firebase中创建或更新地质点,可以直接使用对象地质点(纬度、经度),此示例来自
CollectionReference users=FirebaseFirestore.instance.collection('users');
未来更新程序(){
返回用户
.doc('ABC123')
.update({'info.address.location':GeoPoint(53.483959,-2.244644)})
。然后((值)=>打印(“用户更新”))
.catchError((error)=>打印(“未能更新用户:$error”);
}