flutter handshake failed; returned -1, SSL error code 1, net_error -202

1.用这个插件显示网页

webview_flutter: ^1.0.7

报错

handshake failed; returned -1, SSL error code 1, net_error -202

2.解决办法

用这个插件

flutter_inappwebview: ^4.0.0+4

具体代码

InAppWebView(
  initialUrl: _url,
  onReceivedServerTrustAuthRequest: (controller, challenge) async {
      //解决 handshake failed问题
      return ServerTrustAuthResponse(
          action: ServerTrustAuthResponseAction.PROCEED);
  },
    onLoadStop: (InAppWebViewController controller, String url) {
        loadingDismiss();
        print("网页 onLoadStop--》");
    },
)

参考 https://stackoverflow.com/questions/62038787/fluttere-webview-handshake-failed

posted @ 2021-03-26 11:17  Nixon  阅读(2821)  评论(0编辑  收藏  举报