Search code examples
flutterflutterwebviewplugin

Flutter Web View blank white screen


I am trying to show a web application inside of a flutter app. I have created a web view widget in the body of the app however when i try to load the link "https://maps.chi.ac.uk" is returns the following error:

E/chromium( 4718): [ERROR:ssl_client_socket_impl.cc(996)] handshake failed; returned -1, SSL error code 1, net_error -202

Nothing really out there with this error. The webview works fine with likes of amazon, google and google maps but this site is just not working. Any suggestions/ help would be much appreciated.

Thank you. I have attached a copy of the code as well.

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class Web extends StatefulWidget {
  const Web({super.key});

  @override
  State<Web> createState() => _WebState();
}

class _WebState extends State<Web> {
  WebViewController? _controller;
  @override
  void initState() {
    super.initState();
    _controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setBackgroundColor(const Color(0x00000000))
      ..setNavigationDelegate(
        NavigationDelegate(
          onProgress: (int progress) {
            // Update loading bar.
          },
          onPageStarted: (String url) {},
          onPageFinished: (String url) {},
          onWebResourceError: (WebResourceError error) {},
          onNavigationRequest: (NavigationRequest request) {
            /*if (request.url.startsWith('https://www.youtube.com/')) {
              return NavigationDecision.prevent;
            }*/
            return NavigationDecision.navigate;
          },
        ),
      )
      ..loadRequest(Uri.parse('https://maps.chi.ac.uk'));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("Maps")),
        body: WebViewWidget(
          controller: _controller!,
        ));
  }
}

Solution

  • This has now been resolved. It turns out the website that I was trying to access did not have the correct SSL certificate ratings. After resolving that on the company side, it worked fine.