我在这里对Flutter的添加到应用的当前限制有疑问。
请参阅此文档。 https://flutter.dev/docs/development/add-to-app
As of Flutter v1.12, add-to-app is supported for the basic scenario of integrating one full-screen Flutter instance at a time per app. It currently has the following limitations:
- Running multiple Flutter instances or running in partial screen views may have undefined behavior.
- Using Flutter in background mode is still a WIP.
- Packing multiple Flutter libraries into an application isn’t supported.
- Plugins used in add-to-app on Android should migrate to the [new Android plugin APIs][], based on FlutterPlugin.
Plugins that don’t support FlutterPlugin may have unexpected behaviors if they make assumptions that are untenable in add-to-app (such as assuming that a Flutter Activity is always present).
- As of v1.17, the Flutter module only supports AndroidX applications on
对于此声明
不支持将多个Flutter库打包到应用程序中。
我是否正确理解,我们只能创建1个Flutter模块项目并将其添加到我们的android或ios项目中?
如果是,那么是否有任何解决方法?
您可以通过在Flutter主模块中实现子模块来分离模块,每个子模块将由Flutter引擎控制,这意味着您将拥有多个Flutter引擎,因此每个模块中的状态将保留并与其他。
您可以在此处参考我的演示https://github.com/duytq94/demo-integrate-flutter,部分屏幕和全屏彼此分开。