webview_flutter 3.0.0 Problem Cant Solve It ( onWebViewCreated )

Viewed 671

the problem

I'm using web view flutter 3.0.0 and it doesn't want to accept any thing for the ( on Web View Created ) .. .. so please if someone can solve ill be thankful

2 Answers
  android {
    defaultConfig {
        minSdkVersion 19
    }
}
Using Virtual displays 
Set the correct minSdkVersion in android/app/build.gradle (if it was previously lower than 20):

 android {
     defaultConfig {
         minSdkVersion 20
     }
 }
Set WebView.platform = AndroidWebView(); in initState(). For example:

 import 'dart:io';

 import 'package:webview_flutter/webview_flutter.dart';

 class WebViewExample extends StatefulWidget {
   @override
   WebViewExampleState createState() => WebViewExampleState();
 }

 class WebViewExampleState extends State<WebViewExample> {
   @override
   void initState() {
     super.initState();
     // Enable virtual display.
     if (Platform.isAndroid) WebView.platform = AndroidWebView();
   }

   @override
   Widget build(BuildContext context) {
     return WebView(
       initialUrl: 'https://flutter.dev',
     );
   }
 }

Remove the const keyword before the WebView widget.

Related