我正在尝试执行对本地服务器的 http 请求,但我收到以下 I / flutter (28338) 错误消息:错误状态:平台不允许不安全的 HTTP:http://mylocalip /auth/login,有人知道怎么解决吗?
注意:我也在使用模块化的颤振和 mobx
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.22.0-10.0.pre.251, on Microsoft
Windows [versão 10.0.19041.508], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android
SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)
• No issues found!
I'm trying to make a request to a local http server, the request is a post for a login system that receives username and password by parameter
login() async {
try {
var response = await http.post(http://mylocalip/auth/login,
body: {'username': 'maximosdrr', 'password': '621251'});
print(response.statusCode);
} catch (e) {
print(e);
}
}
并且控制台上的输出如下: I/flutter (28338): Bad state: Insecure HTTP is not allowed by platform: http://mylocalip/auth/login