dart analyze
The dart analyze
command performs the same static analysis that you get when you use an IDE or editor that has Dart support.
Here's an example of performing static analysis over all the Dart files under the current directory:
$ dart analyze
You can customize how the analyzer treats warnings and info-level issues. Normally the analyzer reports failure when it finds any errors or warnings, but not when it finds info-level issues. You can customize this behavior using the --fatal-infos
and --no-fatal-warnings
flags. For example, to make the analyzer fail when any issue is the --fatal-infos
flag:
$ dart analyze --fatal-infos
You can add a directory or a single file argument:
$ dart analyze [<DIRECTORY> | <DART_FILE>]
For example, here's the command to analyze the bin
directory:
$ dart analyze bin
To customize the analysis, use an analysis options file or special comments in Dart source code, as described in Customizing static analysis.
For information on command-line options, use the --help
flag:
$ dart analyze --help
Unless stated otherwise, the documentation on this site reflects Dart 3.6.0. Page last updated on 2024-05-06. View source or report an issue.