Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: WebView(
initialUrl: "https://www.google.com/",
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
},
),
);
}
This is my code snippet how to resolve this issue
While waiting for the official support from Flutter team, you can use flutter-webview-windows
package. It adds support for Windows webview on Flutter and can communicate between the webview and flutter app (more detail here).
final _controller = WebviewController();
@override
void initState() {
super.initState();
_init();
}
void _init() async {
await _controller.initialize();
await _controller.loadUrl('https://flutter.dev');
if (!mounted) return;
setState(() {});
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Webview')),
body: _controller.value.isInitialized
? Webview(_controller)
: const Text('Not Initialized'),
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With