unused_code_cleaner 1.9.1 copy "unused_code_cleaner: ^1.9.1" to clipboard
unused_code_cleaner: ^1.9.1 copied to clipboard

Automatically find and safely remove unused assets, functions, packages, and files from Flutter/Dart projects. Reduce bundle size and improve performance with one command.

Unused Code Cleaner #

Pub Version License: MIT

🧹 Automatically find and remove unused code from your Flutter/Dart projects

Clean up your codebase in seconds - remove unused assets, functions, packages, and files with one simple command.

⚑ Quick Start #

# Install
dart pub global activate unused_code_cleaner

# Preview what will be cleaned (always start here!)
dart run unused_code_cleaner --dry-run --all

# Clean your project
dart run unused_code_cleaner --all

✨ What It Does #

  • πŸ–ΌοΈ Removes unused assets (images, fonts, JSON files)
  • ⚑ Deletes unused functions and methods
  • πŸ“¦ Cleans unused packages from pubspec.yaml
  • πŸ“„ Removes unused Dart files
  • πŸ›‘οΈ Safe by default - creates backups automatically

πŸ“± Perfect For #

  • Flutter apps with too many assets
  • Code cleanup after refactoring
  • Reducing app size before release
  • Maintaining clean codebases

�️ Safety First #

This tool is designed to be safe:

  • βœ… Always creates backups before deletion
  • βœ… Excludes critical files automatically
  • βœ… --dry-run mode to preview changes
  • βœ… Requires confirmation before deletion

Golden Rule: Always run --dry-run first!

πŸ›‘οΈ Safety Features #

πŸš€ Common Commands #

# Clean everything (recommended)
dart run unused_code_cleaner --dry-run --all

# Clean only assets
dart run unused_code_cleaner --assets --dry-run

# Clean only unused packages
dart run unused_code_cleaner --packages --dry-run

# Exclude certain files
dart run unused_code_cleaner --exclude "**/*.g.dart" --dry-run --all

πŸ“‹ Example Output #

πŸ” Analyzing project...
βœ… Found 3 unused assets (saving 2.1 MB)
βœ… Found 5 unused functions
βœ… Found 1 unused package

πŸ“Š Results:
β”œβ”€β”€ πŸ–ΌοΈ  unused_logo.png (1.2 MB)
β”œβ”€β”€ πŸ“„ old_config.json (0.9 MB)
β”œβ”€β”€ ⚑ debugHelper() function
└── πŸ“¦ http package

πŸ’Ύ Total space savings: 2.1 MB
⏱️  Analysis completed in 1.2s

❓ Remove these items? (y/N)

πŸ› οΈ Options #

Command What it does
--all Clean everything
--assets Clean unused assets only
--functions Clean unused functions only
--packages Clean unused packages only
--dry-run Preview without deleting
--verbose Show detailed info

🀝 Contributing #

Found a bug? Want a feature? Open an issue!

πŸ“œ License #

MIT License - free to use in your projects.

6
likes
145
points
123
downloads

Publisher

unverified uploader

Weekly Downloads

Automatically find and safely remove unused assets, functions, packages, and files from Flutter/Dart projects. Reduce bundle size and improve performance with one command.

Repository (GitHub)
View/report issues

Topics

#flutter #optimization #cleanup #assets #performance

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, args, cli_util, colorize, glob, path, yaml

More

Packages that depend on unused_code_cleaner