Skip to content
pubscout

detect_unused_code

3.7.0, released 13 days ago by an unverified publisher

Fast, zero-dependency Dart and Flutter dead code, assets, and packages remediation engine.

$ flutter pub add detect_unused_code
Source repository

What it does

Scans Dart and Flutter projects to safely detect and clean dead classes, unused widgets, commented-out code blocks, unused imports, TODO tasks, unreferenced media assets, and unused external packages. Provides both a terminal control dashboard and a programmatic or CI/CD audit report.

AI-written summary of version 3.7.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to clean up technical debt and remove dead code, unused classes, or orphaned assets in medium to large projects.
  • You need an automated static analysis tool that goes beyond standard dart analyze to catch unused public widgets and models.

Skip it when

  • You are looking for a package to handle state management, routing, or general app architecture.
  • Your project is extremely small and has no need for automated code remediation.

Strengths

  • Zero external dependencies and fast AST-based analysis.
  • Interactive terminal dashboard (TUI) with dry-run previews and instant rollback.
  • Covers 13 code quality points including commented files, dead classes, assets, and dependencies.

Weaknesses

  • Can require careful configuration via pubspec.yaml exclusions for generated files or dynamic assets to avoid false positives.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add as a dev_dependency in pubspec.yaml or activate globally using dart pub global activate detect_unused_code.

detect_unused

Alternatives

Packages that do the same job and could replace detect_unused_code.

  • leancode_lint

    An opinionated set of high-quality, robust, and up-to-date lint rules used at LeanCode.

  • undead

    Reachability and dead/unused declaration analysis for Dart and Flutter packages.

  • ciach

    Dead code detector for Dart and Flutter that finds and removes unused declarations.

  • import_lint

    Defines rules to restrict imports and perform static analysis in Dart code.