Solving the new HTTPS requirements in Flutter
The new beta includes some unexpected surprises
Published in
3 min readOct 22, 2020
Since this morning, after updating my Flutter beta install, it has been refusing to load any resources from HTTP with this error:
Unhandled error Bad
state: Insecure HTTP is not allowed by platform
If you’re here because you’ve been furiously Googling a fix, and you don’t care why it’s broken, and you just want it fixed, here’s what you can do:
- Navigate to your project
- Go to yourapp\android\app\src\debug\AndroidManifest.xml
- Add this line
<application android:usesCleartextTraffic="true">
</application>
4. Build your debug app and deploy it to your device of choice. It should work now.
Why is this happening?
Since a change in dart_sdk
last month, outbound connections are checked to see if they are permitted to occur in plaintext HTTP. The commit that includes this change can be seen here. To be precise, this is the particular lines that are causing us grief: