본문 바로가기
프로그래밍/Flutter-Dart

[Flutter] CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate

by 채연2 2022. 10. 13.

I/flutter: HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393))

 

class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext? context) {
    //for https able to get local issuer certificate
    return super.createHttpClient(context)
      ..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
  }
}

 

void main() {
    HttpOverrides.global = MyHttpOverrides();
}

 

320x100

댓글