Replacing the string localhost
with 10.0.2.2
resolved it for me, since I was running the code in the Android emulator, which is running in a VM. It’s essentially a duplicate of this question.
More Related Contents:
- How to pass basic auth credentials in API call for a Flutter mobile application?
- How do you add query parameters to a Dart http request?
- How to display response from the server in Flutter app screen?
- The argument type ‘String’ can’t be assigned to the parameter type ‘Uri’
- How to solve flutter web api cors error only with dart code?
- How to solve SocketException: Failed host lookup: ‘www.xyz.com’ (OS Error: No address associated with hostname, errno = 7)
- How to set up CORS or OPTIONS for Rocket.rs
- Passing data between screens in Flutter
- Check whether there is an Internet connection available on Flutter app
- What’s the difference between a POST and a PUT HTTP REQUEST?
- Why is it common to put CSRF prevention tokens in cookies?
- Flutter – Wrap text on overflow, like insert ellipsis or fade
- Flutter Error: MediaQuery.of() called with a context that does not contain a MediaQuery
- InkWell not showing ripple effect
- Separate Users and Sellers in the same app with same Firebase in Flutter
- Is a slash (“/”) equivalent to an encoded slash (“%2F”) in the path portion of an HTTP URL
- Enumerate or map through a list with index and value in Dart
- Save cookies between two curl requests
- Do web browsers always send a trailing slash after a domain name?
- What exactly is an HTTP Entity?
- Payloads of HTTP Request Methods
- What HTTP response headers are required
- Domain set cookie for subdomain
- Why is riverpod failing even to initialize in project? Method not found: ‘Error.throwWithStackTrace’
- Error in searching data using listview in flutter
- How should I check if the input is an email address in Flutter? [duplicate]
- Navigating to a new screen when stream value in BLOC changes
- Console errors. Failed to load resource: net::ERR_INSECURE_RESPONSE
- Google map in Flutter not responding to touch events
- Flutter floating action button with speed dial