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
--no-fatal-warnings flags. For example, to make the analyzer fail when any issue is the
$ 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
$ 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
$ dart analyze --help