[英]Unhandled Exception: type 'Future<dynamic>' is not a subtype of type 'String' : Flutter Exception
[英]Unhandled Exception: type 'Future<dynamic>' is not a subtype of type 'String'
這是錯誤發生的地方 LG(); 是來自 API 的字符串
Status() {
String rawJson =
LG();
Map<String, dynamic> map = jsonDecode(rawJson);
}
應該是這樣的
Future Status() async{
String rawJson =
await LG();
Map<String, dynamic> map = jsonDecode(rawJson);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.