Flutter 未处理的异常:类型';未来<;动态>';不是类型为';字符串';

Flutter 未处理的异常:类型';未来<;动态>';不是类型为';字符串';,flutter,dart,Flutter,Dart,这是发生错误的地方LG();是来自API的字符串 Status() { String rawJson = LG(); Map<String, dynamic> map = jsonDecode(rawJson); } Status(){ 字符串rawJson= LG(); Map Map=jsonDecode(rawJson); } 应该是这样的 Future Status()异步{ 字符串rawJson= 等待LG(); Map Map=jsonDecode

这是发生错误的地方LG();是来自API的字符串

Status() {
  String rawJson =
      LG();
  Map<String, dynamic> map = jsonDecode(rawJson);
}
Status(){
字符串rawJson=
LG();
Map Map=jsonDecode(rawJson);
}
应该是这样的


Future Status()异步{
字符串rawJson=
等待LG();
Map Map=jsonDecode(rawJson);
}

非常感谢,这帮了大忙