Pular para o conteúdo

Linter Installation

Este conteúdo não está disponível em sua língua ainda.

To use the linter from the command line, install package:bloc_tools via the following command:

Terminal window
dart pub global activate bloc_tools

Once the bloc command-line tools have been installed, you can run the bloc linter via the bloc lint command:

Terminal window
$ bloc lint --help
Lint Dart source code.
Usage: bloc lint [arguments]
-h, --help Print this usage information.
Run "bloc help" to see global options.

To install the recommended lint rule set, install package:bloc_lint as a dev dependency via the following command:

Terminal window
dart pub add --dev bloc_lint:^0.2.0-dev

Then, add an analysis_options.yaml to the root of your project with the recommended rule set:

analysis_options.yaml
include: package:bloc_lint/recommended.yaml

If needed, you can include multiple rule sets by defining them as a list:

analysis_options.yaml
include:
- package:very_good_analysis/analysis_options.yaml
- package:bloc_lint/recommended.yaml

The following IDEs officially support the bloc linter and language server to provide instant diagnostics directly within your IDE.