-2

I am facing following issue : I/flutter (31349): Bad state: Insecure HTTP is not allowed by platform: http://max-image-caption-generator-test.2886795296-80-host19nc.environments.katacoda.com/model/predict

I added following lines in android/app/src/main/AndroidManifest.xml file

<uses-permission android:name="android.permission.INTERNET" />

<application
android:usesCleartextTraffic="true"
</application>

But still I am facing the error enter image description here

2 Answers2

0

HTTP connections are not allowed anymore since Flutter 2.0 on Android and iOS. There are two solutions: You can use only HTTPS connections or you can activate unsecure connections (e.g. for debugging). The following article describes how to do this: https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android or Flutter Insecure http is not allowed by platform

Mäddin
  • 1,070
  • 6
  • 11
0

You need to take permission to use http

For Android -> android:usesCleartextTraffic="true" in application in AndroidManifest.xml file

<application
  ...
  android:usesCleartextTraffic="true">

For IOS -> add below lines in Info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
Ujjwal Raijada
  • 867
  • 10
  • 21