I'm trying to figure out how to have an iOS device reach my node server from flutter. Node is listening on port 5000, and as you can see in my request is trying port 5000. Currently, I'm getting back a network error 'Connection refused, errno = 61'. Any idea how to fix it?
var url = 'http://localhost:5000/photo';
try {
final res = await http.post(
url,
body: {'photo': photo, 'dir': destination},
headers: {"Accept": "*/*", "Connection": "keep-alive"},
);
print(res.body);
if (res.statusCode >= 400) {
final resBody = json.decode(res.body);
throw HttpException(resBody['errors'][0]);
}
} catch (err) {
throw (err);
}
you should use your computer ip
for windows you can run ipconfig
for linux you can run ifconfig
for mac you can run Ipconfig
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With