Adding WebView to your Flutter app
summary
Adds the webview to a Flutter app using the webview_flutter plugin and shows a working Scaffold with a WebView widget, a WebViewController accessed via a Completer, and navigation controls that actually call canGoBack/canGoForward/reload. Demonstrates a navigationDelegate that blocks YouTube, runs JavaScript (navigator.userAgent), receives messages via JavaScript channels to postSnackBar, manages cookies with CookieManager, and loads assets or HTML strings with loadFlutterAsset/loadHtmlString — all examples run on Android/iOS emulators.
AI-written summary · about
chapters (12)
- 0:00Introduction and setup
- 2:00Creating the project
- 4:42Adding the webview widget
- 7:05Handling page load events
- 10:38Webview controller basics
- 13:34Navigation controls
- 17:39Navigation delegates
- 22:07Executing JavaScript
- 24:48JavaScript channels
- 28:47Managing cookies
- 34:09Loading local assets
- 42:01Conclusion
related talks
27mFrom Mobile to Web: Reusing Flutter via Multi-View Embedding
27mAdd-to-web: Reusing Flutter via multi-view embedding
34mGoogle Flutter: The Next Frontier in Mobile Development
23mA pragmatic approach to WebViews
15mWebViews: fast-tracking features in mobile apps
42mFlutter everywhere — from Mobile to Web
34mOvercoming JavaScript Unsecurities in WebViews
44mAchieving next-level code between Flutter and the Mobile Web
