【发布时间】:2021-07-29 16:22:04
【问题描述】:
当我尝试从 Firestore 获取数据时,会发生此异常。 _TypeError(类型“列表”不是“字符串”类型的子类型) 我找不到问题的原因。请帮忙。
class ActfMiddleWare {
///Fetches LocationData From Firestore and Save it in Store;
locationIndexMiddleware() {
return (Store<AppState> store, action, NextDispatcher next) async {
if (action is GetLocationIndex) {
Future<DocumentSnapshot<Map<String, dynamic>>> locationIndex =
FirebaseFirestore.instance
.collection('locations')
.doc('locationIndex')
.get();
await locationIndex.then((docSnapshot) {
if (docSnapshot.data() != null) {
List temp = docSnapshot.data()!['locations'];
store.dispatch(SaveLocationIndex(payload: temp));
}
});
}
next(action);
};
}
}
【问题讨论】:
标签: flutter dart redux google-cloud-firestore