【问题标题】:Getting a specific document from a nested Firstore subcollection to a streambuilder从嵌套的 Firestore 子集合中获取特定文档到流构建器
【发布时间】:2021-01-13 02:52:33
【问题描述】:

所以,我正在尝试显示一个文档字段,但如果我从前一页输入,它就不起作用。如何从材料页面路径显示这种类型的子集合,我的颤振应用程序不断崩溃。

new StreamBuilder(
                    stream: Firestore.instance
                        .collection("Users")
                        .document(uid) //from firestore getuserID
                        .collection("orders")
                        .document(widget.doc) //from materialpageroute fetched data
                        .snapshots(),

或者这还不支持?

【问题讨论】:

  • 你得到什么错误?

标签: flutter google-cloud-firestore


【解决方案1】:

它给出错误是因为您来自 Firestore 的数据是 A DocumentSnapshot 类型的数据。但是在你的 StreamBuilder 中,你必须有指定的 QuerySnapshot 类型数据

【讨论】:

  • 它实际上是一个 DocumentSnapshot,我只是显示了 widget.doc,而不是从 Streambuilder 抓取文档.. 谢谢
猜你喜欢
  • 2018-11-30
  • 2021-12-16
  • 2021-01-23
  • 1970-01-01
  • 2019-10-06
  • 2020-12-27
  • 1970-01-01
  • 2018-06-19
  • 2018-04-04
相关资源
最近更新 更多