前端老生

flutter使用webview https证书过期不显示问题,忽略 SSL 错误

使用 flutter_inappwebview 插件,忽略 SSL 错误,用 onReceivedServerTrustAuthRequest 事件,并为指定请求或所有请求返回 ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED)。

 

child: InAppWebView(
    initialUrlRequest: URLRequest(
        url: Uri.parse("https://self-signed.badssl.com/")
    ),
    onReceivedServerTrustAuthRequest: (controller, challenge) async {
        return ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED);
    },
),