Making a login screen in flutter when i tap the login it gives the error 'network is Unreachable'.
I have change the ip addresses "10.0.2.2" , "8.7.7.7" but doesn't work.
Error :
E/flutter (16082): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled
Exception: SocketException: Connection failed
(OS Error: Network is unreachable, errno = 101), address = 10.0.2.2, port = 80
CODE :
TextEditingController user=new TextEditingController();
TextEditingController pass=new TextEditingController();
Future<List> _login() async{
final response = await http.post("http://127.0.0.1/my_store/login.php", body: {
"username": user.text,
"password": pass.text,
});
print(response.body);
}
In my case turning on the wifi and making sure that it is connected solved the issue.
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