我使用的是真实设备(不是安卓模拟器)
后端: MongoDb 图集 ,
API:带-beta ,得到这个错误:
I/flutter (30720): SocketException: OS Error: Connection timed out, errno = 110, address = 192.19.170.13, port = 47763
(发现了很多类似的问题,但没有一个是使用真实设备进行测试的)
try {
var ip = '192.19.170.13';
setState(() => _isSubmitting = true);
http.Response response =
await http.post('http://$ip:1337/auth/local/register',
/* I've also tried using localhost(it didn't work) everyone suggested to use my loopback adapter's (Ethernet's ip address) even that isn't working.*/
body: {
'username': _username,
'email': _email,
'password': _password,
});
final responseData = json.decode(response.body);
setState(() => _isSubmitting = false);
_successSnackBar();
print(responseData);
} catch (e) {
setState(() => _isSubmitting = false);
print(e.toString());
}
}
最佳答案
关于mongodb - I/flutter (30720) : SocketException: OS Error: Connection timed out, errno = 110,地址 = 192.19.170.13,端口 = 47763,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60155822/