从颤动的子集合文档中获取数据

Fetch data from subcollection document in flutter

这是我的数据结构。以下是用户文档列表。

这里是每个文档中的子集合。

子集合包含表单的强类型文档。

我想要的是从每个 的子集合 workerField 中获取 form 文档(不适用于当前用户) 用户 文档。 实现方法是什么

如果您想从所有 workerField 集合中加载文档,您可以使用所谓的 collection group query.

所以像这样:

var docs = await FirebaseFirestore.instance
      .collectionGroup('workerField')
      .snapshots();

另一个例子请看我的回答: and more from these search results.