Work

Third Wave Coffee · Jun 2024 – present

Moving a live ordering app from native to Flutter

Third Wave Coffee's ordering app was two native codebases with years of history behind them. I led its move to Flutter without a rewrite freeze. First, Flutter rendered individual features inside the native screens. Once it owned enough of the app, I turned the module into the app itself, and it now ships to Android, iOS and the mobile web from one codebase.

Role
Mobile Engineer
Status
In production on Google Play and the App Store
Platforms
Android, iOS, Mobile web
Stack
Flutter, Dart, BLoC, get_it, Dio + Retrofit, Hive, Sentry, Crashlytics, Firebase Remote Config, FCM, Kotlin, Swift, Method channels, GitHub Actions
  • Menu screen with pickup and dine-in toggle, category rail and product list
    Menu
  • Product customisation sheet with size, milk and syrup add-ons
    Customise
  • Wallet balance with promo offers and transaction history
    Wallet and transactions
  • Subscription packs list with variants and prices
    Packs
  • Loyalty tier progress and member benefits
    Loyalty
method channels, one per surface
13method channels, one per surface
release cycle time
−50%release cycle time
features in one Flutter codebase
38features in one Flutter codebase

The constraint

When I joined in June 2024, the app was two native codebases, Swift on iOS and Kotlin on Android, on one GraphQL backend. Every feature was built twice. A rewrite would have frozen features for months in an app that takes orders every day, so the goal was narrower and harder: reach one codebase without pausing releases.

Phase one: Flutter as a guest

Flutter’s add-to-app compiles a Flutter module into existing native apps. I shipped the first surface, a bottom sheet, into both apps in July 2024, then moved features across one at a time: cart suggestions, promo balance, delivery, the address book and more.

Flutter inside the native Third Wave Coffee apps, 2024 to 2025The native iOS and Android apps each create a FlutterEngineGroup. On iOS five engines are pre-warmed at launch and one is created on first use; on Android a shared group is provided by Dagger and each feature caches its own engine. Every engine runs the same Flutter module, starting at its own route, and renders into native table cells, fragments or a full-screen activity. Thirteen method channels connect each Flutter surface to the native app, which owns login and the session.views inside table cellsfragments, full-screen activityDart side of every channeliOS app · Swiftnative screens, GraphQLowns login and sessionMethod channels13, one per surfaceheaders · cart · refreshAndroid app · Kotlinnative screens, GraphQLowns login and sessionFlutterEngineGroup5 engines pre-warmed at launch1 created on first useFlutterEngineGroupone shared group via Dagger,one cached engine per featureFlutter module · one Dart codebaseeach engine boots at its own routeAAR for Android · CocoaPods for iOSnative ↔ Flutter traffic: request headers, add to cart, refresh, dismiss
Phase one: Flutter as a guest. The native apps kept the session and navigation; Flutter rendered features inside them.
Decision Why What it cost
One engine per surface, spawned from a FlutterEngineGroup An engine renders one view at a time; grouped engines share the GPU context, font metrics and isolate snapshot, so each extra one is cheap Each engine is its own isolate, so two surfaces share no Dart state
Pre-warm engines that render inside lists (five on iOS at launch); create rare ones on demand A cold engine inside a native cell shows up as a blank cell Start-up work for surfaces the user may never open
Native keeps login, session, navigation and shared state; Flutter asks for request headers over a channel One source of truth for who the user is, and no second auth flow to drift The cart and selected store round-trip through native
One named channel per surface (13 in the end), names as constants, unknown calls logged A name that drifts between Dart and native shows up on the first run Bridge code in Dart, Kotlin and Swift for every surface

Debugging was the cost nobody writes down: a bug could start in Swift or Kotlin and surface in Dart, with a debugger and stack trace on each side.

The switch

Bridge code grows with every surface. While Flutter owned a few features it was worth it; once Flutter owned most of the app, it was not. In October 2025 I converted the module into a standalone Flutter app with its own Android and iOS runners. The bridges were deleted, and the same codebase now also builds the mobile website.

The app today

38 features, 28 of them split into data, domain and presentation; the other ten are smaller on purpose.

  • A server-driven home page. The server sends an ordered list of section types. Each section has its own bloc, request and loading state, so one slow section never blanks the page, and a type the app does not recognise renders nothing, so older versions keep working.
  • State placed deliberately. Blocs live at the app root, on a page or in a widget depending on who needs them and how long they should live. More in Where a BLoC should live.
  • Plain wiring. get_it registered by hand, one file per feature. Dio and Retrofit with one client per base URL, sharing interceptors for headers, a Hive-backed response cache and forced logout on an expired session.
  • Tuning outside the build. Firebase Remote Config holds values like the payment polling interval, so they change without a release.

The rules behind it are in Feature architecture.

Reliability

The hardest crashes did not start in the app. Under heavy backend load, responses arrived late, often after the user had left the screen, and updated views that no longer existed. Making the backend faster was not my job; making the app survive it was. On Android, we moved those screens to lifecycle-aware ViewModels, so work stops when its screen goes away. In Flutter, I moved timeout and error handling into one place in the network layer, made parsing null-safe and gave screens a retry state. A slow backend now means a slower screen, not a crash.

I also added Sentry beside the existing Crashlytics and filtered debug-build and layout-overflow noise out, so a real production crash is the first thing anyone sees.

Shipping

I built the release workflow in GitHub Actions: choose the environment and build type, and it bumps the version, commits it and produces the APK or app bundle, with the environment passed in at build time instead of edited into a file. Pushes to the main, dev and release branches run lint, tests and a coverage gate; pull requests get lint on changed files and a branch-name check. Each release follows a written checklist and goes through the Play Store beta track first.

Release cycle time dropped by half once builds were automated.

Beyond the main app

In 2026 the team split shared code into Flutter packages so two new Flutter web apps could reuse it. A colleague designed and led the split; I built features inside the packages, including deep-link handling and configurable profile editing.

What I would do differently

  • Decide the exit on day one. I treated phase one as open-ended. A trigger agreed up front, such as a target number of features in Flutter, would have saved bridge code we later deleted.
  • Raise the test floor as features move. The CI coverage gate was set low during the migration and never raised. I would raise it one feature at a time.
  • Budget for debugging. Two toolchains on every cross-boundary bug is real time. I would plan for it, not discover it.