Modern Flutter and Dart 3 patterns — stop agents from generating deprecated Navigator 1.0, StatefulWidget-heavy, and pre-Dart 3 code.
AI agents are trained on data that includes outdated Flutter patterns. This plugin ensures your agent uses current best practices. Agents commonly get these wrong:
- Navigator 1.0 — Using
Navigator.pushandMaterialPageRouteinstead of GoRouter - Pre-Dart 3 patterns — Long if/else chains instead of sealed classes, Map/dynamic instead of records
- StatefulWidget overuse — setState everywhere instead of Riverpod or proper state management
- Missing const — Widgets that could be const are not, increasing rebuild cost
- Hardcoded styling — Colors and sizes instead of Theme.of(context)
- Nested scrollables — ListView inside Column causing unbounded height errors
/add-plugin flutter-best-practices
/plugin install flutter-best-practices
npx skills add ofershap/flutter-best-practicesOr copy skills/ into your .cursor/skills/ or .claude/skills/ directory.
- flutter-best-practices — Modern Flutter and Dart 3 patterns with Wrong vs Correct code examples
- best-practices — Always-on rules that enforce GoRouter, Dart 3 features, Riverpod, const constructors, and theme usage
/audit— Scan your codebase for Flutter anti-patterns (Navigator 1.0, setState misuse, missing const, etc.)
| Wrong | Correct |
|---|---|
Navigator.push(context, MaterialPageRoute(...)) |
GoRouter with context.go('/path') |
| if/else chains for state | Sealed classes + exhaustive switch |
setState for shared state |
Riverpod providers |
Map<String, dynamic> for grouped data |
Dart 3 records |
Widget() without const |
const Widget() |
| Hardcoded colors/sizes | Theme.of(context) |
| ListView inside Column | CustomScrollView with slivers |
| Raw String for entity IDs | Extension types |
dynamic type |
Proper types or Object? + pattern matching |
MIT