flutter - Flutter:如何从 Cloud Firestore 的数组数据字段中获取数据?
问题描述
我在 Firestore 中检索数据时遇到问题。我在我的字段中创建了数据,该数据是一个数组。现在我在检索它时遇到了问题。我在检索数据时使用 StreamBuilder。我怎样才能找回它?我的数据在“活动 - 随机 ID - 问题 { 我想要获取的数据数组}”中。请帮忙。
我的代码:
StreamBuilder<QuerySnapshot>(
stream: db.collection('ACTIVITIES').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Column(
children: snapshot.data.documents
.map((doc) => buildItem(doc))
.toList());
} else {
return SizedBox();
}
})
我的数据库结构:
解决方案
推荐阅读
- r - 在 R Studio 中,我将如何从 Yahoo Finance 中提取特定数据
- javascript - JavaScript 中 Map 和 For 循环的时间复杂度
- openapi - Quarkus OpenAPI 包括 Keycloak API
- c - 为什么我生成的 .a 静态库包含对我个人计算机的路径/引用?
- python - Python 循环代码不会与求解器代码一起打印,可能还有其他问题吗?
- java - 如何使用嵌套 for 循环的输出值作为同一个 for 循环的新输入值?
- c++ - 使用glfw,opengl时ImGui的问题
- javascript - 如果触发条件,我如何隐藏元素?
- javascript - 如何以编程方式格式化开始和结束标签之间的文本,然后删除标签
- python - 如何从 JSON 数据框中仅读取特定列?