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
References
- Writing dual-end platform code (plug-in writing and implementation)
- Harmony Flutter function development
- Harmony add-to-app example
- How to use hybrid development module](https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%B7%B7%E5%90%88%E5%BC%80%E5%8F%91%20module.md)
Top comments (0)