Handshake error in client : CERTIFICATE_VERIFY_FAILED Self signed certificate in flutter Handshake error in client : CERTIFICATE_VERIFY_FAILED Self signed certificate in flutter dart dart

Handshake error in client : CERTIFICATE_VERIFY_FAILED Self signed certificate in flutter


This works for me

void main() {  HttpOverrides.global = new MyHttpOverrides();  runApp(MyApp());}class MyHttpOverrides extends HttpOverrides{  @override  HttpClient createHttpClient(SecurityContext context){    return super.createHttpClient(context)      ..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;  }}class MyApp extends StatelessWidget {.....


As previously mentioned in the comments, the HTTP request gets through since it returns a 405 error. HTTP error 405 usual points is usually defined as "Method not allowed", and commonly caused by incorrect request method. You may want to check with the server if it can receive the request that you're sending.


    DioForNative dio = DioForNative();    DefaultHttpClientAdapter httpClient = dio.httpClientAdapter;    httpClient.onHttpClientCreate = (HttpClient client) {      client.badCertificateCallback =          (X509Certificate cert, String host, int port) {        return true;      };    };

and then you can make dio.post and dio.get requests.