【发布时间】:2021-05-19 18:11:18
【问题描述】:
我正在按文档 ID 获取数据,但出现此错误:
错误状态:无法获取 DocumentSnapshotPlatform 上不存在的字段
它工作,我可以通过文档ID从firebase获取数据,但它在调试控制台中给出了错误。
我正在使用 StreamBuilder 获取数据:
StreamBuilder(
stream: _databaseService.productCollection.doc(docID).snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
valueColor:
new AlwaysStoppedAnimation<Color>(Colorsx.mainColor),
),
);
}
var document1 = snapshot.data;
return Container(
decoration: BoxDecoration(
color: Colorsx.mainColor,
borderRadius: radius,
),
// color: Colorsx.mainColor,
child: Column(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Chip(
label: LabelText1("Ürün Adı: "),
backgroundColor: Colorsx.mainColor,
),
Chip(
shadowColor: Colorsx.mainColor2,
elevation: 24,
label: LabelText1(document1["productName"] ?? ""),
backgroundColor: Colorsx.mainColor2,
),
],
),
),
],
),
);
},
),
我在这里找不到问题,但根据我的研究,它与 map 相关。 有什么想法吗?
【问题讨论】:
标签: android firebase flutter dart google-cloud-firestore