How to add Geopoint, timestamp and reference to a document in Firestore trough Flutter

て烟熏妆下的殇ゞ 提交于 2020-12-03 04:03:57

问题


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

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

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

Any help or examples?


回答1:


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

For TimeStamp you can pass DateTime object directly from dart.

For Geopoint there is GeoPoint object inside Firestore plugin.

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

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



来源:https://stackoverflow.com/questions/50573854/how-to-add-geopoint-timestamp-and-reference-to-a-document-in-firestore-trough-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!