【发布时间】:2023-03-31 04:35:01
【问题描述】:
嘿,我最近将我的 cloud_firestore 依赖项从版本 0.12.9+4 更新到了 2.2.1。现在我必须对我的代码进行一些更改。我已经阅读了如何迁移 2.0.0 版的代码并更改了部分代码。但我不知道如何在这部分更改它:
//imbiss list from snapshot
List<Imbiss> _imbissListFromSnapshot(QuerySnapshot snapshot) {
return snapshot.docs.map((doc) {
return Imbiss(
name: doc.data["name"],
kind: doc.data["kind"],
location: doc.data["location"],
rating: doc.data["rating"],
ratingFood: doc.data["ratingFood"],
ratingLocation: doc.data["ratingLocation"],
ratingPLV: doc.data["ratingPLV"],
ratingService: doc.data["ratingService"],
date: doc.data["date"],
user: doc.data["user"],
);
}).toList();
}
代码之前运行得非常好,现在我在 doc.data 之后的括号中出现错误。 Android Studio 告诉我:没有为类型“Object Function()”定义运算符“[]”。你知道我必须做什么吗?
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore