在 Firestore 中,我有一个包含数组类型字段的文档,我想从 flutter app 向其添加日期时间值。任何人都可以建议一种方法吗?
最佳答案
存储:
使用DateTime.now().millisecondsSinceEpoch
这将为您提供一个 int
值作为返回,您可以将该值保存在 Firestore 中。
检索:
您可以使用 DateTime.fromMillisecondsSinceEpoch(valueSavedInFirestore)
DateTime
关于flutter - 如何将值添加到从 flutter 到 firestore 的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52444222/