大家好,我正在尝试从服务器 api 获取数据,同样在邮递员中工作得很好,但是当我从 flutter 中点击时,我得到以下异常
I/flutter (20104):
这是我的代码
var bodyMap = json.encode(map);
final response = await client.post(
"$baseUrl/api/Course/List",
headers: {"content-type": "application/json"},
body: bodyMap,
);
print("##courses coming"+response.toString());
if (response.statusCode == 201) {
print("##coming to 201");
return responseFromJson(response.body);
}else if(response.statusCode == 400)
{
print("##coming to 400---"+response.statusCode.toString());
print("##coming to 400-body-"+responseFromJson(response.body).toString());
return responseFromJson(response.body);
}
else {
print("##coming to 200---"+response.body.toString());
var s=responseFromJson(response.body);
print("##coming to success-"+s.toString());
return responseFromJson(response.body);
}