我试图使用json读取Firestore中的数据,而Map类型必须实现可迭代
Stream<List<RentModel>> readData(){
var json = collection.document("rent").snapshots();
List<RentModel> rentModel = List();
return json.map((document) {
for (var index in document.data){ // error is here in document.data that: the type Map<String, dynamic> must implements iterable
rentModel.add(RentModel.fromJson(index));
}
return rentModel;
});
}