📚 Encyclopedia

Flutter & Mobile · updated 2026-10-13

Flutter app architecture, state management and packages (2026 survey)

flutterdartarchitectureriverpodblocpackagesanimationmvvm

A survey of community best practice for structuring a professional Flutter app, compiled in March 2026 for the SMC site rebuild. It is a snapshot of consensus and pub.dev popularity, not something each item was proven on; use it as a starting point when choosing a stack. Package "likes" figures are from that date.

Architecture

State management ranking (March 2026)

  1. Riverpod 3 as the default: compile-time safe, little boilerplate, async-first.
  2. BLoC/Cubit for event-driven or audit-heavy apps (use Cubit about 80% of the time, full BLoC for the rest; immutable states; never pass a BuildContext into a bloc).
  3. Provider is now mainly for beginners (Riverpod is its successor).
  4. GetX not recommended (tight coupling, hard to test).
  5. Signals emerging for fine-grained reactivity.

Responsive layout and theming

Animation guidance

Package shortlist

Need Package
State flutter_riverpod (or flutter_bloc)
Routing go_router (official; deep links, redirects, shell routes)
HTTP dio with an interceptor chain (auth, logging, retry, cache); retrofit for typed clients
Models freezed, json_serializable, build_runner
DI get_it (+ injectable)
Theming flex_color_scheme, google_fonts
Animation flutter_animate, animations, rive, lottie
Images/SVG cached_network_image, flutter_svg, extended_image
Charts fl_chart
Lists/grids infinite_scroll_pagination, flutter_staggered_grid_view, scrollable_positioned_list
Forms flutter_form_builder
Loading skeletonizer, shimmer
Testing mocktail, alchemist (goldens), patrol (E2E)
Rich text flutter_quill, flutter_markdown, flutter_html
Adaptive nav flutter_adaptive_scaffold

Lessons from a real codebase (Run, 2026 audits)

Run is Justin's Flutter/Flame game (about two years of features, audited 2026-03 and 2026-10). What actually hurt, in rough order: - Untyped API responses: ApiResponse.body as dynamic forced as Map casts everywhere, and malformed JSON crashed at runtime. Typed models (LeaderboardEntry, PersonalBest, ...) fixed a whole bug class. Add a 30 s HTTP timeout too; without it a network hiccup was an instant silent failure. - God classes: the game world, player and editor screen reached 600-2000+ lines; extracting managers (checkpoints, deaths, dimensions, ghosts, rotation) made them testable. - Singletons everywhere (static final instance) made mocking impossible. DI (get_it or Riverpod) or at least injectable constructors pay off once tests exist. A global singleton is still fine for genuinely app-wide state (Run's cheat manager must exist before any game does). - No router: 36 files built inline MaterialPageRoutes and a screen took 7 optional constructor params to know which level to show. Use go_router and typed route params from the start (go_router navigation patterns and opening your own links in-app). - Theme bypassed: 194 raw Color(...) literals in screens while an AppColors class sat unused. - Layering inverted: a runtime factory lived in the editor's models folder and imported ~30 game components, while game files imported editor models. Keep a neutral model package that both depend on. - Magic numbers (grid 32, 5-frame cooldowns, 300 ms freezes) belong in named constants; stringly-typed values ('DIAMOND') belong in enums; scattered debugPrint wants a logger. - Fire-and-forget init (audioInit().catchError(...)) hides failures; add a timeout and tell the user when a subsystem is unavailable. - Watch list from the same research: Dart macros were canceled (Jan 2025) in favor of augmentations; primary constructors are coming; WASM is becoming the default web target.

See also

Linked from

Sources: tldr memory (ui-ux-m3-polish), smc-flutter memory (reference_web_design_research, March 2026), run memory (architecture-audit.md, architecture-audit-2026-10.md, research-architecture-patterns.md)