Check Dependencies
Checks missing, under-promoted, over-promoted, and unused dependencies.
To execute the command, run:
$ dcm check-dependencies lib # or dcm d lib
Full command description:
Usage: dcm check-dependencies [arguments] <directories>
-h, --help Print this usage information.
--ignored-packages=<my-package,other,...> Package names that should be ignored.
-r, --reporter=<console> The format of the output of the analysis.
[console (default), json]
-c, --print-config Print resolved config.
--root-folder=<./> Root folder.
(defaults to current directory)
--sdk-path=<directory-path> Dart SDK directory path.
If the project has a `.fvm/flutter_sdk` symlink, it will be used if the SDK is not found.
--exclude=<{/**.g.dart,/**.freezed.dart}> File paths in Glob syntax to be exclude.
(defaults to "{/**.g.dart,/**.freezed.dart}")
--no-congratulate Don't show output even when there are no issues.
--[no-]verbose Show verbose logs.
--ci-key The license key to run on CI server.
--email The email used to purchase the license.
--no-analytics Disable sending anonymous usage statistics.
--[no-]fatal-found Treat dependency issues as fatal.
(defaults to on)
Ignoring particular packages from the report
In order to ignore particular packages from the report, pass the --ignored-packages
option to the CLI.
Output example
Console
Use --reporter=console
to enable this format.
JSON
The reporter prints a single JSON object containing meta information and the unused code file paths. Use --reporter=json
to enable this format.
The root object fields are
formatVersion
- an integer representing the format version (will be incremented each time the serialization format changes)timestamp
- a creation time of the report in YYYY-MM-DD HH:MM:SS formatdependencyIssues
- an array of dependency issues
{
"formatVersion": 1,
"timestamp": "2021-04-11 14:44:42",
"dependencyIssues": [
{
...
},
{
...
},
{
...
}
]
}
The dependencyIssues object fields are
path
- a relative path of the unused fileissues
- an array of issues detected in the target file
{
"path": "lib/src/some/file.dart",
"issues": [
...
],
}
The issue object fields are
message
- the message associated with the issueoffset
- a zero-based offset of the dependency location in the pubspec.yaml fileline
- a zero-based line of the dependency location in the pubspec.yaml filecolumn
- a zero-based column of the dependency location in the pubspec.yaml file
{
"message": "Dependency is unused",
"offset": 156,
"line": 7,
"column": 1
}