首页 > 解决方案 > 从嵌套的 Firstore 子集合中获取特定文档到流构建器

问题描述

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

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

或者这还不支持?

标签: fluttergoogle-cloud-firestore

解决方案


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


推荐阅读