Error:
lib/main.dart:46:13: Error: Setter not found: 'platformCallbacksHandler'.
WebView.platformCallbacksHandler = (method, args) async {
^^^^^^^^^^^^^^^^^^^^^^^^
lib/main.dart:44:24: Error: The method 'clearHistory' isn't defined for the class 'WebViewController'.
- 'WebViewController' is from 'package:webview_flutter/src/webview.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dev/webview_flutter-2.8.0/lib/src/webview.dart').
Try correcting the name to the name of an existing method, or defining a method named 'clearHistory'.
_webViewController.clearHistory();
^^^^^^^^^^^^
Solution:
The use of WebView.platformCallbacksHandler and clearHistory() in the most recent webview_flutter package version appears to be problematic. Changes to the package API are most likely the cause of the error.
This is a revised version of your code that makes use of the most recent webview_flutter package:
I’ve changed WebView.platformCallbacksHandler to window in this version.JavaScript’s addEventListener is used to interact with Flutter. Additionally, since clearHistory() is not required for this functionality, I have removed it. Make sure the webview_flutter package is up to date in your pubspec.yaml file.