错误是:
Closure call with mismatched arguments: function '[]'
Receiver: Closure: () => Map<String, dynamic> from Function 'data':.
Tried calling: []("quizImgUrl")
Found: []() => Map<String, dynamic>
试图从我的代码中获取图片网址:
ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) {
return QuizTile(
imgUrl: snapshot.data.documents[index].data["quizImgUrl"],
desc: snapshot.data.documents[index].data["quizDesc"],
title: snapshot.data.documents[index].data["quizTitle"],
);
});
以以下方式从Firebase获取数据:
getQuizData() async {
return await Firestore.instance.collection("Quiz").snapshots();
}
答案 0 :(得分:1)
user snapshot.data.docs。他们在Firebase软件包的最新更新中进行了许多重大更改。