dartd 0.1.0 copy "dartd: ^0.1.0" to clipboard
dartd: ^0.1.0 copied to clipboard

CLI to analyze and remove unused Dart classes or modules.

dartd #

CLI to analyze and remove unused Dart classes or modules in a project.

Features #

  • analyze: reports unused classes and lib/ modules (files not imported/exported/parted).
  • fix: removes unused class blocks and unreferenced lib/ modules.
  • Supports JSON output for tooling and --dry-run for safe previews.

Install #

dart pub global activate dartd

Usage #

dartd analyze --root /path/to/project [--json]
dartd fix --root /path/to/project [--dry-run]

Options:

  • -r, --root: project root (default: current directory)
  • --json: emit analysis as JSON
  • --dry-run: show planned removals without writing files

Notes and limitations #

  • Heuristic detection: classes referenced via reflection/dynamic calls may be flagged as unused.
  • Generated files (*.g.dart, *.freezed.dart, *.gen.dart, *.gr.dart) are ignored.
  • Module detection only considers imports/exports/parts within the package.
  • Review output before applying fixes on critical codebases.

Development #

dart pub get
dart format .
dart analyze .

License #

MIT

2
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

CLI to analyze and remove unused Dart classes or modules.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on dartd