flutter_doctor_ai 0.1.0
flutter_doctor_ai: ^0.1.0 copied to clipboard
AI-powered Flutter code analysis CLI tool. Detects issues like large build methods, missing dispose, empty setState, and provides AI-powered fix suggestions.
0.1.0 #
Initial release.
Features #
-
5 built-in static analysis rules
large_build_method— warns when abuildmethod exceeds 50 linesempty_setstate— warns onsetState(() {})calls with an empty closureprint_statement— flagsprint()calls in production code (outsidetest/)missing_mounted_check— warns whensetStateis called afterawaitwithout amountedguardmissing_dispose— warns when disposable fields (AnimationController,TextEditingController,ScrollController,StreamSubscription, etc.) are not disposed in thedispose()method; also detects missingsuper.dispose()calls
-
AnalysisEngine— single-parse architecture: each file is parsed once and all rules run against the same AST, returning both findings and codebase statistics (totalClasses,totalWidgets,statelessCount,statefulCount) in a singleProjectAnalysisResult -
ProjectScanner— recursively scans a project'slib/directory, readspubspec.yamlfor metadata, and reports file count, total lines of code, and scan time -
HealthScorer— calculates a 0–100 health score with letter grade (A–F), normalised by issues per 1 000 lines of code; errors weighted 3×, warnings 1×, info 0.25× -
AI integration — optional AI-powered fix suggestions for the top 3 issues; supports four providers with automatic model fallback:
- Groq (default:
llama-3.3-70b-versatile) - Gemini (default:
gemini-2.5-flash) - OpenAI (default:
gpt-4o-mini) - Anthropic (default:
claude-sonnet-4-20250514)
- Groq (default:
-
CLI (
flutter_doctor_ai analyze)--verbose/-v— show all individual issues with file and line number--json/-j— emit structured JSON output for CI/CD pipelines--ai— enable AI suggestions (interactive or via--api-key)--provider/-p— choose AI provider (groq,gemini,openai,anthropic)--model/-m— override the AI model
-
Extensible rule system — implement
BaseRuleto add custom checks without modifying the package