0 purchases
analysis options
Analysis Options for Dart/Flutter #
The set of rules that encourage good coding practices for applications, packages, and plugins.
Features #
Analyzer and Linting Rules
Getting started #
To add the package, analysis_options, to an project:
Depend on it
Add analysis_options under dev_dependencies in the pubspec.yaml file.
Install it
From the terminal: Run flutter pub get.
Import it
Add a corresponding include statement in the YAML code.
Usage #
To use the analysis options, add the following dev dependency in your pubspec.yaml file:
dev_dependencies:
analysis_options: any
copied to clipboard
Add the following line in your analysis_options.yaml file:
include: package:analysis_options/analysis_options.yaml
copied to clipboard
Additional information #
Analyzer: Customize static analysis.
Linter: Configure linter rules.
Enabling stricter type checks #
analyzer:
language:
strict-casts: true
copied to clipboard
Enabling individual rules #
linter:
rules:
- avoid_print
copied to clipboard
Disabling individual rules #
linter:
rules:
public_member_api_docs: false
copied to clipboard
Excluding files #
analyzer:
exclude:
- lib/generated_plugin_registrant.dart
copied to clipboard
Ignoring rules #
analyzer:
errors:
todo: ignore
copied to clipboard
Changing the severity of rules #
analyzer:
errors:
dead_code: info
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.