【发布时间】:2021-11-14 10:33:42
【问题描述】:
我正在尝试从 firestore 读取我的 uid1 和 uid2 文档中的所有字段。我的代码崩溃了,因为 fromJson 无法将 imageList 从数组转换为 List。
Future<List<AppClient>> getClientListResult(List<String> listId) async{
final List<AppClient> clientList = <AppClient>[];
print(listId);
final QuerySnapshot<Map<String, dynamic>> snapshot = await _firestore.collection('clients').where('uid', arrayContainsAny: listId).get();
final List<AppClient> result = snapshot.docs.map((QueryDocumentSnapshot<Map<String, dynamic>> doc) => AppClient.fromJson(doc.data())).toList();
clientList.addAll(result);
return clientList;
}
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore