class _MyHomePageState extends State<MyHomePage> {
final WebviewController _webViewController = WebviewController();
@override
void initState() {
super.initState();
initWebState();
}
Future<void> initWebState()async{
try{
await _webViewController.initialize();
await _webViewController.loadUrl("file:///F:/language/hbuilderx/code/test/test3.html");
_webViewController.webMessage.listen((event) {
});
setState(() {});
}on Exception catch(e){
developer.log("$e");
}
}
@override
Widget build(BuildContext context){
return Scaffold(
body: SizedBox(
child: Webview(_webViewController),
),
);
}
}
标签:windows,WebviewController,await,webViewController,initState,override,webview,flu
From: https://www.cnblogs.com/sqmw/p/17027508.html