To transition your code from flutterwebviewplugin to webview_flutter, you can follow these steps:
Add webview_flutter package to your pubspec.yaml file and run pub get to install the package.
Replace the import statement of flutterwebviewplugin to webview_flutter in your dart file(s).
Replace the FlutterWebviewPlugin() constructor to WebView() from the Webview_flutter package.
If you have previously set any configuration like url, headers, initial child, and more in flutterwebviewplugin, you need to update them accordingly. For example:
a. To set an initial URL, use the initialUrl property of WebView class.
b. To set headers, use the headers property of WebView class.
c. To use a custom WebView widget as the initial child of WebView, use the initialChild property of WebView class.
Remove the dispose method from your flutterwebviewplugin code.
You can also use the JavaScriptChannel class for communication between webview and the Flutter app.
Finally, run your code to check if everything is working correctly.
Note that Flutter Team recommends using webviewflutter package to support webviews in your app as flutterwebview_plugin package is outdated and will no longer be supported.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-06 09:26:39 +0000
Seen: 12 times
Last updated: May 06 '23
What is the method for invoking a Dart asynchronous function from JavaScript?
When transferring an object from Dart to JavaScript, what is the role of LegacyJavaScriptObject?
What is the process for creating a webview in Flutter?
In a new Flutter project on Android Studio, is it possible to not have any libs or main.dart file?
How can Google calendar events be generated on the server-side using Flutter?
How can I retrieve an SVG image from a URL in Flutter?
How can I combine streams of different types in Dartlang using rxdart?