【发布时间】:2020-03-18 06:23:38
【问题描述】:
Future<List<DocumentSnapshot>> finallist() async {
List<DocumentSnapshot> finallist;
Future createList(QuerySnapshot snapshot) async {
List<DocumentSnapshot> listoflocationforsingle = snapshot.documents;
for (DocumentSnapshot u in listoflocationforsingle) {
print('Added ' + u.data['country']);
finallist.add(u);
}
}
finallist.add(u) 因 add on null 错误而失败。
Exception has occurred.
NoSuchMethodError (NoSuchMethodError: The method 'add' was called on null.
Receiver: null
Tried calling: add(Instance of 'DocumentSnapshot'))
即使当我将鼠标悬停在 createlist(data) 中的数据上时,它也会显示 QuerySnapshot 列表以及我的 firestore 数据库中的数据。
【问题讨论】:
标签: android flutter google-cloud-firestore