dartd 0.2.0
dartd: ^0.2.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 andlib/modules (files not imported/exported/parted).fix: removes unused class blocks and unreferencedlib/modules.- Supports JSON output for tooling and
--dry-runfor 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