unused_code_cleaner 1.9.1
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 #
๐งน 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.