【填坑】Unhandled Exception: type 'List<String>' is not a subtype of type 'String' in type cast

 

原代码:

var Params = {
"tokens":["1"],
"data": "123",
};
final response = await http.post(url, body: Params); //post请求

解决办法:
Map<String, dynamic> body = {
"tokens":["1"],
"data": "123",
};
var response = await Dio()
.post("http://192.168.1.100:4001/api",data: body);
print(response);

 

posted @ 2020-04-14 11:13  Locog  阅读(3912)  评论(0编辑  收藏  举报