如何在 Flutter webview 中读取网站内容?

How to read website content in Flutter webview?

我想阅读用 Flutter webview 打开的页面的内容。在页面打开之前,用户需要手动输入上一页的信息,而我在后台用http是没机会做的。如何获取WebView打开页面的数据(可以是webview_flutter或flutter_webview_plugin)。提前致谢。

开箱即用的东西并没有完全用于此目的,但是,webview_flutter 支持使用 JavascriptChannel 与页面进行通信。使用 controller.evaluateJavascript,您可以注入一个脚本,将页面内容发送到使用 postMessage. See the examples in the plugin repo 的频道。