I want my Flutter Android app to reject all clear‑text HTTP traffic (i.e. only allow HTTPS).
AndroidManifest.xml
xml
<application
…
android:usesCleartextTraffic="false"
android:networkSecurityConfig="@xml/network_security_config">
…
</application>
Network Security Config (android/app/src/main/res/xml/network_security_config.xml)
xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- Disallow all cleartext -->
<base-config cleartextTrafficPermitted="false"/>
</network-security-config>
What happens instead: Despite those settings, I am still able to fetch an HTTP URL in Dart/Dio, for example:
dart
final response = await Dio().get('http://httpstat.us/200');
print(response.statusCode); // prints 200