Flutter 是否可以在flatter中从json主体打印多个属性?
一直在尝试在同一行的flatter中打印json正文中的多个属性。似乎不知道该怎么做。任何帮助都会很有吸引力Flutter 是否可以在flatter中从json主体打印多个属性?,flutter,dart,Flutter,Dart,一直在尝试在同一行的flatter中打印json正文中的多个属性。似乎不知道该怎么做。任何帮助都会很有吸引力 void getData() async { Response response = await get('https://jsonplaceholder.typicode.com/todos/1'); Map data = jsonDecode(response.body); print(data); print(data['id']); } 这是我运行终端时返回的结果 [{"id
void getData() async {
Response response = await get('https://jsonplaceholder.typicode.com/todos/1');
Map data = jsonDecode(response.body);
print(data);
print(data['id']);
}
这是我运行终端时返回的结果
[{"id":475,"result":{"value":"android","type":"_extensionType","method":"ext.flutter.platformOverride"}}]
[+373 ms]I/flatter(4562):{userId:1,id:1,title:deletus aut autem,completed:false}
[]I/flatter(4562):1根是数组
试试这个
数据[0]['id']
如果要在同一行中打印某些数据,请尝试以下操作:
print('response:${data}id:${data['id']}')
提示:生成模型,重新排列u。链接-