15

When I run my Flutter app that makes a network connection to an HTTP URL, I get an error: Bad state: Insecure HTTP is not allowed by platform

I get an exception like this every time I make a network request using Dio.

DioError [DioErrorType.DEFAULT]: Bad state: Insecure HTTP is not allowed by platform: <my_private_api_url>
Mr Bhati
  • 641
  • 7
  • 7
Ahmad Mohy
  • 391
  • 2
  • 6
  • 18
  • 1
    you might need to give us more context here. What exact command are you running? what version of flutter are you on, etc... – Didier Prophete Sep 19 '20 at 15:15
  • You can use [edit] link below your post to edit your question instead of posting information as an answer – Suraj Rao Sep 19 '20 at 17:59
  • 1
    Please have a look [here](https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android#migration-guide). Under the Migration section, you can find instructions for iOS and Android. – bshears Sep 21 '20 at 17:40
  • 3
    read this may help you: https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie. I have solved this problem.@Ahmad Mohy – Dolphin Oct 04 '20 at 13:02
  • @Ahmad how did you solve this problem ? – nimi0112 Oct 28 '20 at 03:27
  • For iOS Add this line in Xcode project info.plist `NSAppTransportSecurity NSAllowsArbitraryLoads ` – Himanshu Parashar Oct 28 '20 at 06:34
  • https://stackoverflow.com/q/64197752/1318946 – Pratik Butani May 13 '21 at 14:16
  • this showing because of not using API using HTTP and flutter the latest version of the android version not allow HTTP user HTTPS. – Mr Bhati May 23 '21 at 11:02

0 Answers0