Playbook

Flutter add-to-app

Add-to-app lets a Flutter module render inside an existing native app. I ran it in production in both the iOS and Android Third Wave Coffee apps for over a year. What matters in practice:

One engine per surface, from a FlutterEngineGroup. An engine renders one Flutter view at a time, so showing two Flutter surfaces at once, say a cart-suggestion strip and a promo-balance card in the same native list, takes two engines. Engines spawned from one group share the GPU context, font metrics and isolate group snapshot, which makes each extra one cheap. Each engine boots straight into its own route.

Pre-warm what appears in lists. Starting an engine takes a moment, so a surface created on demand inside a native list shows up as a blank cell first. On iOS, five engines started at launch for the surfaces that render inside native screens; a rare one, the discount-success dialog, was created on first use. On Android, each feature kept a cached engine from one shared group, provided through Dagger, so reopening a Flutter fragment or full-screen activity did not pay the start-up cost again.

Isolates share nothing. Each engine runs in its own isolate, so two Flutter surfaces on the same screen do not share Dart state. Anything shared, like the cart or the selected store, has to round-trip through the native app over platform channels. Design for that from the first surface, not the fifth.

Debugging gets harder. A bug can start in Swift or Kotlin and surface in Dart, or the other way round, and each side has its own debugger, logs and stack traces. To step through Dart code running inside the native app, you start the host from Xcode or Android Studio and connect with flutter attach. Hot reload works there, but every native change still means a full rebuild. Two habits help. Log every channel call a handler does not recognise, so a name that drifted between Dart and native shows up at once. And reproduce bugs in the real host app, not a standalone Flutter run: many only appear when both sides are running.

Package it like a dependency. The module shipped as an AAR for Android and through CocoaPods for iOS, so the native apps consumed Flutter the way they consume any other library.

Know when to leave. Add-to-app is a bridge, not a destination. Once Flutter owns most of the app, the bridge costs more than it saves, and it is time to make Flutter the app. Migrating to Flutter covers that switch.