Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何编写jsonDecode?_Flutter_Flutter Layout_Flutter Test - Fatal编程技术网

Flutter 如何编写jsonDecode?

Flutter 如何编写jsonDecode?,flutter,flutter-layout,flutter-test,Flutter,Flutter Layout,Flutter Test,当我从api接收时,如何解码这种响应格式 当我使用 ** Map=json.decode(response.data) ** 错误:未处理的异常:类型“\u InternalLinkedHashMap”不是类型“String”的子类型。您需要解码正文而不是数据 { "success": true, "msg": { "name": "xxxx", "Id": "1

当我从api接收时,如何解码这种响应格式

当我使用

**

Map=json.decode(response.data)

**


错误:
未处理的异常:类型“\u InternalLinkedHashMap”不是类型“String”的子类型。

您需要解码正文而不是数据

{
  "success": true,
  "msg": {
    "name": "xxxx",
    "Id": "123",
  }
}
像这样访问它

Map resultMap = jsonDecode(request.body);

它已经解码,您正在尝试再次解码。自动解码我的意思是,如果我们直接使用ResponseEyes,您不必担心,但当我使用controller.storeDetails.toString()时,它显示为空
resultMap['success']