鸿蒙Flutter开发中集成Webview

主要有两种方案

使用第三方库

使用 flutter_inappwebview 插件,在 pubspec.lock 文件中配置:

编写原生 ArkTS 代码实现 PlatformView
创建 entryablitiy

src/main/module.json5 中配置 ablitiy

cat src/main/entryablity/CustomFactory.ets

cat src/main/entryablity/CustomPlugin.ets

cat src/main/entryablity/CustomView.ets

cat src/main/entryablity/EntryAbility.ets

创建 pages

cat src/main/ets/pages/index.ets

src/main/resources/base/profile/main_page.json 中配置路由

在 Dart 侧调用该 PlatformView

参考链接


鸿蒙Flutter实战:03-鸿蒙Flutter开发中集成Webview