我正在创建一个可以在 android 和 web 平台上运行的 flutter 项目。 我在网络平台上查看 html 时遇到问题。
我使用了一个插件webview_flutter在android平台上查看html,但是这个插件不支持web平台。
webview_flutter 包是专门为移动平台设计的。如果您想使用网络平台,我建议使用 easy_web_view 包。它自动使用 webview_flutter 库在移动平台和网站上工作。
或者,您也可以进行平台检查并有条件地更改库:
import 'package:flutter/foundation.dart' show kIsWeb;
if (kIsWeb) {
// running on the web!
} else {
// NOT running on the web! You can check for additional platforms here.
}
参考资料: