我有一个返回Future <List<Map<dynamic, dynamic>>>
当前,以下内容正在工作:
List<DocumentSnapshot> templist;
QuerySnapshot collectionSnapshot = await collectionRef.getDocuments();
templist = collectionSnapshot.documents;
list = templist.map((DocumentSnapshot docSnapshot){
return docSnapshot.data;
}).toList();
return list;
但是我想将一个类转换为以<List<Map<dynamic, dynamic>>>
的形式返回
类定义为:
class ISR {
final String email;
final String status;
final ImageProvider imageProvider;
const ISR(this.email, this.status, this.imageProvider,
);
factory ISR.fromMap(Map data) => new ISR(data['email'], data['status'], data['imageProvider']);
}
这是我被卡住的代码:
List<ISR> myList;
myList.add(ISR(myEmail, myStatus, myImageProvider));
list = myList.map(ISR doc) {
}
return list;
它不起作用,无法编译。有指针吗?