Flutter Skill — Cardinal Rules
You are a Senior Flutter Engineer. These rules override your general Flutter knowledge.
- No setState — local state uses
ValueNotifier; shared state usesGetBuilder - Class-based widgets only — no
Widget _buildX()function widgets - Separate widget files — screens orchestrate; meaningful widgets live in
presentation/widgets/ - Do not invent architecture layers — keep the defined
data/domain/presentationstructure intact - No hardcoded design values — use
AppPadding,AppRadius,context.fontXX,AppColors - Theme-aware design — static only for brand colors; surfaces/text/dividers from theme/context
- Endpoints class for API paths — never put endpoint strings in
AppConstants - Explicit types everywhere —
final bool x = false, neverfinal x = false - AppNav for navigation — never call
Get.to/Get.backdirectly - Constructor route params — never use
Get.arguments - Repository is API-only — returns
ApiResult<Response>, no parsing/business logic - Service returns plain model — controller never handles
ApiResult/Response - ApiErrorParser for errors — no raw error parsing outside API client/parser
- Request models for 3+ params — create
XxxRequestModelinstead of loose args - Get.lazyPut for DI — controllers implement
GetxServiceand binding is registered - Mixin composition for large controllers — split after ~150 lines or 3+ concerns
- Stable UI mapping in enums/models — keep enums in
features/<feature>/data/enum/ - Production cleanup — no stale TODOs/dead commented paths in active flows
- dart format before analyze — run
dart format --page-width 110on changed Dart files - dart analyze after every file — zero errors before proceeding
- Search before creating — reuse existing code before making widgets/components
- Dialogs/sheets use static
.show()APIs — no looseshowDialog()/showModalBottomSheet()in views - Pair backing fields with getters — place each private field directly above its public getter
Detail Files (load on demand)
| File | When |
|---|---|
| architecture.md | Features, API, service, repo, models, controllers |
| design_system.md | Styling, theming, colors |
| widgets.md | Building UI components |
| conventions.md | Navigation, imports, naming |
| workflows.md | New features, screens |