dart-static-analysis
Installation
SKILL.md
Analyzing and Linting Dart Code
Contents
- Configuring Analysis Options
- Managing Linter Rules
- Resolving Type Promotion Failures
- Workflow: Static Analysis Setup and Execution
- Workflow: Fixing Type Promotion
- Examples
Configuring Analysis Options
Control static analysis by placing an analysis_options.yaml file at the root of your package.
- Enforce Strict Type Checks: Always enable
strict-casts,strict-inference, andstrict-raw-typesin theanalyzersection to catch implicit dynamic casts and un-inferred types at compile time. - Configure Formatting: Define
dart formatrules within theformattersection (e.g.,page_widthandtrailing_commas). - Exclude Generated Code: Use the
excludekey to ignore generated files (e.g.,**/*.g.dart,**/*.freezed.dart) to prevent false positives.