Flutter web view
Hey friends, have a happy weekend. After a long gap of lock down, I just came back. I know 2020 will be so hard for everyone. Hope everything fine soon.
Today we gonna see the flutter web view. In android we used call WebView. It's similar like that. Let's dive on that.
First of all, add the library in pubspec.yaml
webview_flutter: ^0.3.21
then If you want to load the html page from your assets, you add into pubspec.yaml like below:
assets:
- assets/sample.html
Please be careful with intent, because yaml is very sensed on that. Either it won't be work.
you can see the full example in my gist:
https://gist.github.com/vignarajj/59a518610a2bfeb09ad4b0b6d8fe7c69
If you directly call url, just call like that,
WebView(
initialUrl: 'https://google.com',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
},
));
Comments