flutter mobile(android emulator) http post doesn't reaches website

Viewed 203

My http.post request doesn't gives any answer on my mobile(android emulator) flutter. On the browser it gives the classic XMLHttpRequest error but thats not the topic.

final response = await http.post('https://www.notthewebsite.de/420/lalala.php', body: {
  "eMail": eMail.text,
  "password": password.text,
});

var datauser = json.decode(response.body);

And it doesn't reaches the website because if it would call website it would insert something into a data base. But the insertion into the database works when i start the website manually.

Thx for any answer.

2 Answers

Can you access websites on a browser (e.g. Chrome) on the emulator?

I've always needed to start my emulator with the -dns switch, otherwise name resolution fails:

c:\AndroidSDK\emulator\emulator.exe -avd Android-28-Playstore-x64 -dns-server 8.8.8.8 
Related