DEV Community

Cover image for HarmonyOS Flutter Practice: 07-Hybrid Development
shaohushuo
shaohushuo

Posted on

HarmonyOS Flutter Practice: 07-Hybrid Development

HarmonyOS Flutter hybrid development mainly has two forms.

1. Based on har

Package the flutter module into a har package and introduce it in the native Harmony project as a har package.

The advantage is that the main project developer does not need to pay attention to the Flutter implementation and does not need to install and configure the Flutter development environment. The disadvantage is that the Flutter code cannot be modified in time and there is no hot reload.

2. Based on source code

Introduce the Flutter module in the native Harmony project through source code dependency.

The advantage is that it is easy to maintain and update the Flutter code, and hot reload can also be used. The disadvantage is that the Flutter development environment needs to be built and the developers need to master Flutter.

Its project structure is similar to the following:

.
├── AppScope
│   ├── app.json5
│   └── resources
│   ├── base
│   └── rawfile
├── build-profile.json5
├── dependencies
│   ├── hvigor-4.1.1.tgz
│   ├── hvigor-ohos-arkui-x-plugin-3.1.0.tgz
│   └── hvigor-ohos-plugin-4.1.1.tgz
├── entry
│   ├── build-profile.json5
│   ├── hvigorfile.ts
│   ├── oh-package.json5
│   └── src
│   └── main
├── flutter_module
│   ├── BuildProfile.ets
│ ├── Index.ets
│ ├── build-profile.json5
│ ├── consumer-rules.txt
│ ├── hvigorfile.ts
│ ├── libs
│ │ └── arm64-v8a
│ ├── obfuscation-rules.txt
│ ├── oh-package.json5
│ └── src
│ ├── main
│ ├── ohosTest
│ └── test
├── har
│ ├── GT-HM-1.0.4.har
│ ├── flutter.har
│ ├── flutter_boost.har
│ ├── flutter_module.har
│ └── lib_base.har
├── hvigor
│   └── hvigor-config.json5
├── hvigorfile.ts
├── local.properties
├── oh-package.json5
├── package-lock.json
└── package.json
Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)