首页 > 解决方案 > 如何通过 Flutter 在 Firestore 中添加 Geopoint、时间戳和对文档的引用

问题描述

在 Firestore 中设置基本类型相当简单。

但我找不到如何使用颤振 Firestore 插件构建 Geopoint、Timestamp 和另一个文档参考。

Map<String,dynamic>为每个对象设置为coollection的内部数据是什么?

有什么帮助或例子吗?

标签: firebasegoogle-cloud-firestoreflutter

解决方案


我在服务器上手动创建了一个对象并将其放入我的颤振应用程序中。 在此处输入图像描述

对于 TimeStamp,您可以DateTime直接从 dart 传递对象。

对于 Geopoint,Firestore 插件中有 GeoPoint 对象。

new GeoPoint(longitude: 3.4, latitude: 4.5) })

对于另一个文档引用,您可以将DocumentReference检索到的值作为值传递给数据对象。


推荐阅读