The set of rules that encourage good coding practices for applications, packages, and plugins.
Analyzer and Linting Rules
To add the package, analysis_options
, to an project:
-
Depend on it
- Add
analysis_options
underdev_dependencies
in thepubspec.yaml
file.
- Add
-
Install it
- From the terminal: Run
flutter pub get
.
- From the terminal: Run
-
Import it
- Add a corresponding
include
statement in the YAML code.
- Add a corresponding
To use the analysis options, add the following dev dependency in your pubspec.yaml
file:
dev_dependencies:
analysis_options: any
Add the following line in your analysis_options.yaml
file:
include: package:analysis_options/analysis_options.yaml
Analyzer
: Customize static analysis.Linter
: Configure linter rules.
analyzer:
language:
strict-casts: true
linter:
rules:
- avoid_print
linter:
rules:
public_member_api_docs: false
analyzer:
exclude:
- lib/generated_plugin_registrant.dart
analyzer:
errors:
todo: ignore
analyzer:
errors:
dead_code: info