如何在Firestore槽Flutter中添加Geopoint,时间戳和对文档的引用 [英] How to add Geopoint, timestamp and reference to a document in Firestore trough Flutter

查看:39
本文介绍了如何在Firestore槽Flutter中添加Geopoint,时间戳和对文档的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firestore中设置基本类型非常容易.

It is fairly straightforward hot to set basic types inside Firestore.

但是我找不到如何使用Flutter Firestore插件构造Geopoint,Timestamp和其他文档参考.

But I cannot find how to construct Geopoint, Timestamp and another document reference with flutter Firestore plugin.

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

What do you assing inside data that you set to the coollection Map<String,dynamic> for each object?

有什么帮助或例子吗?

推荐答案

我在服务器上手动创建了一个对象,并将其放入我的flutter应用程序中.

I created manually an object on the server and got it inside my flutter app.

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

For TimeStamp you can pass DateTime object directly from dart.

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

For Geopoint there is GeoPoint object inside Firestore plugin.

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

对于另一个文档参考,您可以将作为值检索的 DocumentReference 传递给数据对象.

For another document reference, you would pass DocumentReference that you retrieved as a value to the data object.

这篇关于如何在Firestore槽Flutter中添加Geopoint,时间戳和对文档的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆