Building Flutter Apps
A strict Flutter architecture skill and plugin for teams that want Riverpod,
Freezed, typed GoRouter, Hive CE, localization, tests, accessibility, and
runtime proof enforced the same way every time.
This is not a generic Flutter tips repo. It is an opinionated policy package for
building Flutter apps with one clear architecture and enough local enforcement
that an agent cannot quietly drift into weaker patterns.
It is unofficial. It is not affiliated with Google, Flutter, Dart, Riverpod, or
their maintainers.
What It Enforces
The target app shape is simple:
UI widgets
-> generated Riverpod providers and notifiers
-> repositories
-> local or remote datasources
-> APIs, Hive boxes, platform plugins
Domain entities stay pure Dart.
Navigation goes through typed GoRouter routes.
User-facing copy goes through gen-l10n.
Behavior is proven with tests, lints, hooks, evals, and E2E evidence.
The main rules:
- Providers are generated with
@riverpod / @Riverpod; manual provider
constructors are out.
- State and domain models use sealed Freezed classes; hand-written immutable
patterns are out.
- Widgets render and dispatch only. Business logic, storage, networking, and
policy live behind their owning provider, notifier, repository, datasource, or
service.
- Async work is guarded with
ref.mounted or context.mounted.
- Domain primitives with meaning become Value Objects.
- Route strings are owned by typed GoRouter definitions and generated helpers.
- Visible strings, tooltips, and semantic labels come from
AppLocalizations.
- Shared/realtime flows need writer plus observer proof, not screenshots.
Why This Is Opinionated
Flutter lets teams build the same feature many ways. That flexibility is useful
for experiments, but it is expensive when agents are writing production code:
each extra acceptable pattern becomes another place for drift, hidden state, weak
tests, or shallow wrappers.
This architecture chooses one path on purpose. It is better for this workflow
because it makes ownership obvious:
| Common drift | This architecture forces |
|---|
| Widgets reaching into storage, HTTP, or plugins. | Widgets render localized UI and dispatch user intent only. |
| Notifiers mixing state transitions with SDK details. | Notifiers own state; repositories and datasources own IO boundaries. |
| Domain models shaped by JSON, Hive, or Flutter widgets. | Domain stays pure Dart with explicit Value Objects and invariants. |
| Route strings copied through the app. | Typed GoRouter routes are the navigation source of truth. |
| "Looks fine" UI changes without proof. | Lints, hooks, tests, accessibility checks, evals, and E2E proof all matter. |
The tradeoff is deliberate: less framework freedom, more repeatability. The goal
is not to cover every valid Flutter style. The goal is to make one strict style
easy to review, easy to test, and hard for an agent to accidentally weaken.
How Enforcement Works
Install it as a plugin when you want enforcement. A raw SKILL.md install is
guidance-only and cannot register runtime hooks.
| Layer | What it does | Source |
|---|
| Skill | Loads the rules, trigger map, and pre-flight checklist into the agent context. | SKILL.md |
| Hooks | Blocks obvious drift after edits and before the agent stops. | hooks/ |
| Analyzer | Enforces AST-level Flutter/Riverpod rules through dart analyze. | analysis_options.yaml |
| Dart Decimate | Gates dead code, cycles, duplication, complexity, dependency hygiene, and changed-code risk. | dart-decimate.md |
| Evals | Defines trigger, routing, and answer-quality regression cases. | evals/ |
| References | Holds detailed guidance so SKILL.md stays small and direct. | references/ |
For Flutter/Riverpod packages, the hard project gates are package-root dart analyze with flutter_skill_lints and riverpod_lint wired under top-level
plugins: in analysis_options.yaml, plus Dart Decimate after every write
batch. Pure-Dart CLI packages use their native Dart analysis profile without
either plugin.
Enforcement Coverage