title: webview_flutter "Failed to validate the certificate chain" SSL handshake failed error
body: <p>I had this problem and solved it with the help of <a href="https://stackoverflow.com/questions/54222165/ssl-error-prevents-website-login-in-flutter">this</a> but it took me some time to figure out where to put the code since the codes are a bit different between <strong>flutter_webview_pugin</strong> vs <strong>webview_flutter</strong>. so this a tutorial to show how to implement this method for <strong>webview_flutter</strong> on MacOS(on windows only file may differ)</p>
  
  <p>1- copy this folder <em>/Volumes/.../Flutter/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.10+4</em> to one step up from the root of your project somewhere like for example.</p>
  
  <p>If this is your project: <strong><em>/Volumes/Depo/MyProject/</em></strong>
  Then it's convenient to put the plugin folder here: <strong><em>/Volumes/Depo/edited/</em></strong></p>
  
  <p>2- <strong>Then open this file</strong> /Volumes/Depo/edited/webview_flutter-0.3.10+4/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebViewClient.java</p>
  
  <p>and add this line</p>
  
  <pre><code>@Override
  public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
  }
  </code></pre>
  
  <p>to internalCreateWebViewClient function.
  after you're done it should look like this</p>
  
  <pre><code>private WebViewClient internalCreateWebViewClient() {
      return new WebViewClient() {
        @TargetApi(Build.VERSION_CODES.N)
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
          return FlutterWebViewClient.this.shouldOverrideUrlLoading(view, request);
        }
  
        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
          handler.proceed();
          }
  
        @Override
        public void onPageFinished(WebView view, String url) {
          FlutterWebViewClient.this.onPageFinished(view, url);
        }
      };
    }
  </code></pre>
  
  <p>3- add these imports</p>
  
  <pre><code>import android.net.http.SslError;
  import android.webkit.SslErrorHandler;
  </code></pre>
  
  <p>Since this method bypasses SSL its not recommended for production use.</p>
  
  <p>This problem occurs even if the server's SSL certificate is valid.
  Because a valid SSL doesn't guarantee that every service reached by clients via that domain will end up using the same origin in my case I was trying to connect to the server to stream security cam using RTSP but it was "101 Switching Protocols" on the first request to a different port where there is no valid SSL is implemented.</p>