If you are coding or debugging Flutter Web App and you get a ClientException: XMLHttpRequest error, uri=https:/ you may need to allow Network Requests.
1. Allow network requests in the browser
When running your Flutter Web app, you need to allow network requests in the browser. Here are the steps for different browsers:
- Google Chrome:
- Open Google Chrome and navigate to
chrome://flags/
. - Search for “Experimental Web Platform features” and enable it.
- Restart Google Chrome.
- Open Google Chrome and navigate to
- Microsoft Edge:
- Open Microsoft Edge and navigate to
edge://flags/
. - Search for “Experimental Web Platform features” and enable it.
- Restart Microsoft Edge.
- Open Microsoft Edge and navigate to
2. Run your Flutter Web app
Start your Web app as usual. When the app starts, it will fail, because it is started on localhost, but, your server may be somewhere on your network, and even somewhere remote. Don’t close it – Just minimize it. After that – open new tab in the normal browser session and paste the URL from the debug tab. It should work as expected.
3. Disable the Flag
When you are finished Debugging – don’t forget to disable the flag again! Otherwise you will leave your browser to insecure state!
I”ve used this while developing a Proof of Concept of Web Desktop: https://programtom.com/dev/product/flutter-web-desktop-user-interface-proof-of-concept/