| name | flutter-format |
| description | Run Flutter/Dart formatting and code cleanup workflows. Use when asked to format Flutter projects, run flutter analyze, apply dart fix --apply, or ensure formatting is clean and warning-free before commit/merge. |
Flutter Format
Workflow
- Confirm the working directory is the Flutter project root (contains
pubspec.yaml). - Run
flutter analyze. - If issues are found and automated fixes are safe, run
dart fix --apply. - Run
dart format .(ordart format lib testif only source/test should change). - Re-run
flutter analyzeto confirm no warnings or errors. - List the files changed and summarize what was modified.
Guidance
- If
dart fix --applysuggests risky changes or fails, ask the user how to proceed. - If formatting spans generated files or vendor code, ask before applying.
- If analysis warnings persist and the fix is unclear, stop and ask the user for direction.