Coding Standard: Flutter (ui-application)

By Engineering Team•September 27, 2026•5 min read

Flutter is the platform’s one client framework for the customer-facing mobile app — one codebase compiled natively to both iOS and Android — see ADR-00010 for why. This doc is the concrete rulebook ui-application is actually held to; Architecture-00007 covers the client feature triads across both ui-application and ui-admin-application side by side.

The GetX Feature Triad

Every screen or feature directory must have exactly these layers:

  1. Binding — declares dependencies for the page lifecycle.
  2. Controller — business state, reactive streams, page logic.
  3. View — pure declarative UI tree consuming controller state.
  4. Service (optional — add only when a feature’s controller needs business logic beyond wiring one repository call to state, e.g. joining multiple repositories, caching, request shaping) — lives in lib/core/services/<feature>_service.dart, injected into the Controller; once a Service layer exists for a feature, the Controller never calls a Repository directly.

A feature opened via Get.bottomSheet/Get.dialog (no GetPage(binding: ...) entry to wire it automatically) requires the caller to invoke <Feature>Binding().dependencies() immediately before opening it.

Shared-controller gotcha — always pass a tag

Every screen reusing one GetX controller class must pass a unique tag on both Get.lazyPut/Get.put and Get.find, or multiple screens collide into one stale singleton instance instead of getting their own controller state. This is a repeat-offender bug pattern in this codebase — check for a missing tag first whenever a shared-controller screen shows stale data from a different instance.

Firebase App Check — client mirror

  • Activation: firebase_service.dart’s _activateAppCheck() → FirebaseAppCheck.instance.activate(...).
  • Dev/local bypass: AndroidDebugProvider/AppleDebugProvider, pinned to EnvConfig.appCheckDebugToken.
  • Production: AndroidPlayIntegrityProvider/AppleAppAttestWithDeviceCheckFallbackProvider.
  • The debug-token value must match across ui-application, ui-admin-application, and user-secure-engine’s FIREBASE_APPCHECK_DEBUG_TOKENS — a mismatch fails closed (401), not open, but silently.

Tracing

Browser/mobile clients initialize tracing and inject traceparent + X-Correlation-ID via an HTTP client interceptor — never X-Tenant-ID (the app gets tenant scope from the Firebase JWT, decoded server-side by Nginx).

No over-engineering

No extra abstractions, error handling, or features beyond what the task requires. Don’t add a Service layer to a feature whose controller only wires one repository call to state.

Comments

No comments unless the WHY is genuinely non-obvious.