I’m following this tutorial, and once I run flutter run
on project it returns these error messages,
I have tried upgrading flutter SDK and changing Android minSDK version and nothing seems to work.
lib/main.dart:25:7: Error: The getter 'WebView' isn't defined for the class '_WebViewAppState'.
- '_WebViewAppState' is from 'package:webview_in_flutter/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WebView'.
WebView.platform = SurfaceAndroidWebView();
^^^^^^^
lib/main.dart:25:26: Error: The method 'SurfaceAndroidWebView' isn't defined for the class '_WebViewAppState'.
- '_WebViewAppState' is from 'package:webview_in_flutter/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'SurfaceAndroidWebView'.
WebView.platform = SurfaceAndroidWebView();
^^^^^^^^^^^^^^^^^^^^^
lib/main.dart:37:19: Error: Couldn't find constructor 'WebView'.
body: const WebView(
^^^^^^^
What’s wrong here, this happens for both Android and Web browser debugging.
2
Answers
You can get controller from ‘onWebViewCreated’
found solution on: https://github.com/flutter/flutter/issues/117808