kitta
kitta

Reputation: 2069

Flutter add-to-app, Can we add multiple Flutter module into native project?

I have a question with Flutter's add-to-app current limitation here.

Refer to this doc. 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 

For this statement

Packing multiple Flutter libraries into an application isn’t supported.

Am I understand correctly that we can only create and add 1 Flutter module project into our android or ios project?

If yes then is there any workaround to do that?

Upvotes: 4

Views: 4012

Answers (1)

Duy Tran
Duy Tran

Reputation: 1149

You can separate your module by implement sub-module inside your main Flutter module, each sub-module will be controlled by a Flutter engine, meaning you'll have multiple Flutter engines, so state in each module will be kept and separated with the others.

You can refer my demo here https://github.com/duytq94/demo-integrate-flutter, partial screen & full screen is separated from each other.

Upvotes: 2

Related Questions