I cloned my code on different PCs. It works on some of them and doesn't work on the others. I have a login screen with a mobile number. when I send a request nothing happens and it doesn't give any responses. but that exact same code works fine on other pc and send verification code. I don't know what is the difference that makes it not work on my pc.
Future<Response> init(String mobile) async {
Response response;
try {
response = await Dio()
.post(URLs.BASE_URL + URLs.INIT, data: InitModel(mobile: mobile));
} on DioError catch (e) {}
return response;
}
and here I call it:
void onPressed() {
var text = tEC?.text?.trim();
init("0$text").then((response) {
setState(() {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => ConfirmCode(
mobileNum: tEC.text,
message: response.data['message'],
),
),
);
});
});
}
It was because of the emulator's proxy setting. I change it from "android studio proxy setting" to "no proxy".