ERROR:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:连接被拒绝 E/flutter (12270):

问题描述 投票:0回答:1

This is log printed here

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);
  });
}

}

android flutter runtime-error
1个回答
0
投票

这个错误可能不是你这边的。可能是服务器宕机了 当服务器未运行或检查您的本地主机是否正常工作时,我也遇到了同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.