Future apicall() 异步{ http.Response 响应;
// response = await http.get(Uri.parse('https://reqres.in/api/users/1'));
response = await http.get(
Uri.parse('http://localhost:1337/api/registrations?populate=*'));
print(response.statusCode);
if (response.statusCode == 200) {
setState(() {
// stringResponse = response.body;
mapResponse = json.decode(response.body);
print(mapResponse);
});
}
}
这个错误可能不是你这边的。可能是服务器宕机了 当服务器未运行或检查您的本地主机是否正常工作时,我也遇到了同样的问题