I'm writing a Flutter application which involves getting some data from an HTTP server. Here's my code:
// the local IP of my testing server
final String SERVER = 'http://192.168.1.13:5000';
class Database {
Future<String> _getJob(int jobID) async {
var response = http.get('$SERVER?jobID=$jobID');
return response.body;
}
}
Currently this is the output:
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = 192.168.1.13, port = 41966
Obviously this is happening because there isn't anything on port 41966, but the request shouldn't be going to that port, it should be going to port 5000. Is there a different way of specifying the port?
(my async code probably isn't very good, i'm going to work on it once i've figured this out)