How to Communicate with a Server Using a Self-Signed Certificate (My Own CA) Without Errors in Flutter's HTTP Client

Flutter
2021-03-12 02:02 (5 years ago)
How to Communicate with a Server Using a Self-Signed Certificate (My Own CA) Without Errors in Flutter's HTTP Client

Write this somewhere

class DevHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext context) {
    return super.createHttpClient(context)
      ..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
  }
}

HttpOverrides.global = new DevHttpOverrides();

https://stackoverflow.com/questions/59622087/flutter-https-with-self-signed-certificate

Please rate this article
Current rating: 5.0 (1)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive