【发布时间】:2021-01-29 09:30:31
【问题描述】:
我正在尝试使用 orderBy() 在颤振上对一些数据进行排序
当我尝试按名称或任何内容排序但不使用时间时,它会起作用
这就是我在 Fire Store 上存储数据的方式
FirebaseFirestore.instance.collection('cars').add({
'time ': Timestamp.now(),
'name': name,
'phone': mobile,});
这是排序代码
stream: FirebaseFirestore.instance
.collection('cars')
.orderBy('time', descending: true)
.snapshots(),
即使在 firebase 控制台中,排序也不起作用,但是当我从控制台添加时间戳时 它直接工作,我可以按时间排序,但我从代码中添加的数据没有用它排序。
【问题讨论】:
-
你用什么插件来生成时间戳?
-
我是 Flutter 新手,你能解释一下你对时间戳插件的意思吗
-
Timestamp类是什么? -
我用它来为 StatefulWidget 表单中的表单数据添加时间,如果你的意思是这样的话
-
我发现问题是'时间'有一个空间来尝试帮助
标签: firebase flutter dart google-cloud-firestore timestamp