I successfully resolved my issue by using webview_flutter_plus: ^0.1.1+9 and incorporating the Visibility widget with the required settings. The code snippet demonstrating this solution is provided below:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Webview counter: ' + scounter),
),
body: Column(
children: <Widget>[
Visibility(
visible: false,
maintainState: true,
child: SizedBox(
height: 1,
child: WebViewPlus(
onWebViewCreated: (controller) {
this._webViewController = controller;
controller.loadUrl("files/test.html");
},
onPageFinished: (url) {
_webViewController.getHeight().then((double height) {
print("height: " + height.toString());
setState(() {
_height = height;
});
});
},
javascriptMode: JavascriptMode.unrestricted,
javascriptChannels: <JavascriptChannel>[_counterx()].toSet(),
),
),
),
Text("Webview above"),
],
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
_webViewController.evaluateJavascript('reset()');
},
),
);
}