function that gets triggered after button click in flutter. whenever i click the button, theres a connection error and nothing on the server side.
`void getTest() async {
BaseOptions options = BaseOptions(
baseUrl: "http://10.0.2.2:3000",
// connectTimeout: 1000,
// receiveTimeout: 3000,
);
Dio dio = Dio(options);
try {
Response resp = await dio.post(
options.baseUrl + "/test",
);
} catch (e) {
print("Exception: $e");
}
}`
code for node server. im running node server on localhost:3000
`const express = require('express');
const { Server } = require('ws');
const app = express();
app.get("/test", function(req, res){
console.log(req)
});
app.post("/test", function(req, res){
console.log(req)
});
app.listen(3000, function() {
console.log("Server started on port 3000");
});
`
debug console shows this error
`Exception: DioError [DioErrorType.connectTimeout]: Connecting timed out [0ms]`