skills/dart/dart-run-static-analysis/SKILL.md
Configure project linter rules, configure `analysis_options.yaml`, enforce strict static type checking, and manage fine-grained file or line-level diagnostic suppressions.
npx skillsauth add dhruvanbhalara/skills dart-run-static-analysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enforce strict formatting, stylistic cleanliness, and code sanity by configuring analysis_options.yaml in the root of your Dart package:
include directive. Prefer package:lints/recommended.yaml for pure Dart packages or package:flutter_lints/flutter.yaml for Flutter applications.analyzer: language: configuration to eliminate unsafe dynamic types:
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
linter: rules:. Use a map key structure (rule_name: true/false) to explicitly activate or deactivate rules when overriding an inherited configuration.formatter: node (e.g. configuring page_width: 80).When an analyzer warning or style lint yields a false positive or hits generated files, suppress the warning explicitly using one of these strategies:
analyzer: exclude: list using standard glob patterns:
analyzer:
exclude:
- "lib/generated/**"
- "**/*.g.dart"
// ignore_for_file: diagnostic_name on a dedicated line at the absolute top of the Dart file to disable specific rules across the entire file context.// ignore: diagnostic_name on the line directly preceding the target statement, or appended at the end of the matching line.pubspec.yaml by injecting comments (e.g. # ignore: sort_pub_dependencies).Follow this checklist to perform static code auditing:
analysis_options.yaml exists at the project root.dart analyze .
dart analyze . --fatal-infos
Follow this checklist to apply mechanical quick-fixes automatically:
analysis_options.yaml.dart fix --dry-run
dart fix --apply
dart format .
dart analyze reports clean results.analysis_options.yaml Templateinclude: package:lints/recommended.yaml
analyzer:
exclude:
- "lib/generated/**"
- "**/*.g.dart"
- "**/*.freezed.dart"
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
todo: ignore
missing_required_param: error
missing_return: error
linter:
rules:
always_declare_return_types: true
avoid_empty_else: true
prefer_const_constructors: true
sort_pub_dependencies: false
formatter:
page_width: 100
trailing_commas: preserve
// 1. Suppress all instances of unused variables inside this specific file
// ignore_for_file: unused_local_variable
void calculateMetrics() {
// 2. Suppress a single line using a preceding comment ignore
// ignore: invalid_assignment
int x = 'not_an_int';
final unusedString = 'value'; // File-level ignore handles this
// 3. Suppress at the end of the line
final double pi = 3.14; // ignore: constant_identifier_names
}
development
Perform REST API networking operations (GET, POST, PUT, DELETE) using the lightweight and robust standard `http` package, including platform configurations and background parsing models.
development
Configure internationalization and localization support using Flutter's built-in l10n system, App Resource Bundle (ARB) files, and ICU formatting syntax.
development
Create model classes with fromJson/toJson using dart:convert and Dart 3 pattern matching. Use when manually mapping JSON to classes, parsing HTTP responses, or choosing between manual and code-generated serialization.
data-ai
Diagnose and fix Flutter layout constraint violations (RenderFlex overflow, unbounded height/width, ParentData misuse). Use when encountering layout exceptions, yellow-black overflow stripes, or red error screens.