I have build an project on flutter (frontend) and fastapi(backend), database is Mysql(hosted). server is not hosted The output of my project is perfect on emulators, however I connect my phone with it(developer mode is on).
When app starts I can only splash, login and signup screens. The issue is when I try to login the app doesn't repsonse by any message like any error or debug messages. Both my laptop and mobile phone are connected to same internet. And Api is also not hitting.
Note: I've already add internet permission
Same Network of both laptop and mobile disabled windows defender
You have to host your server on 0.0.0.0 and then hit your API on the IP your server gives you both the mobile device and the server should be running on the same server every time when you start the server on a new network the IP changes so check that also.
For Example in python i do this:
if __name__ == '__main__':
app.run(debug=DEBUG, host=HOST, port=PORT)
DEBUG = True HOST = '0.0.0.0' PORT = 5000
When i run this server it gives a local IP address which i can use in flutter
And in Flutter it would look something like
static const String baseUrl = 'http://192.168.162.197:5000';
static const String endpoint= '$baseUrl/recommend';
Also you have to allow clear text traffic in the android manifest file