image_cleaner_cli 0.0.5
image_cleaner_cli: ^0.0.5 copied to clipboard
A Dart CLI tool to detect, preview, and delete unused or unwanted image assets from your Flutter project.
🧼 image_cleaner_cli #
A Dart CLI tool to detect, preview, and delete unused image assets in your Flutter project.
Clean up your codebase with an interactive, browser-based preview of unused images.
⭐ Found this helpful? Give it a star on GitHub!
🎬 Demo #
✅ Features #
- 🔍 Detect unused images in your Flutter project's
assets/folder by default (e.g., runningimage_cleaner_cli examplewill only checkassets/). Ifassets/doesn't exist, it will checkimages/. To scan a custom folder, pass its relative path as an argument. - 🧪 Dry-run mode (
--dry-run) to preview without deleting - 🌐 Automatically launches a local interactive HTML preview
- 🗑️ Delete selected images directly via the browser UI
- 💻 Works on macOS, Windows, and Linux
- ⚙️ Simple CLI, no setup or config required
🚀 Installation #
📦 Global Activation #
dart pub global activate image_cleaner_cli
Then run the tool from anywhere:
image_cleaner_cli
🔁 Make sure your Dart
binpath (e.g.,~/.pub-cache/bin) is in your system'sPATH.
📌 Installing a Specific Version #
dart pub global activate image_cleaner_cli <version>
Example:
dart pub global activate image_cleaner_cli 0.0.5
▶️ Run Locally Without Global Install #
Clone or open your local project and run:
dart run bin/image_cleaner_cli.dart
📂 Scan a Specific Project Folder #
image_cleaner_cli /path/to/your/flutter/project
Or, when running locally:
dart run bin/image_cleaner_cli.dart /path/to/your/flutter/project
▶️ Usage Arguments: #
<project_folder>
Path to your Flutter/Dart project root or to a specific assets/images folder. You can pass either a relative or absolute path.
Examples:
image_cleaner_cli example/assets
image_cleaner_cli example/images
image_cleaner_cli example
If omitted, the current working directory will be used.
By default, the tool checks for an assets/ folder; if none is found, it checks for an images/ folder.
If you want to scan a custom folder, pass it as an argument:
image_cleaner_cli example/customFolder
⚙️ CLI Options #
| Flag | Alias | Description |
|---|---|---|
--dry-run |
-d |
Preview unused images (no deletion) |
--help |
-h |
Display help and usage info |
🛠 How It Works #
- Checks if an
assets/folder exists in the target path, if yes, scans it; if not, scansimages/. - You can also pass a custom folder’s relative path to scan instead.
- Finds image files not referenced in any
.dartfiles. - Starts a local web server (
http://localhost:8080). - Opens an interactive UI where you can:
- ✅ Review all unused images.
- 🗑️ Select and delete them safely with a single click.
💡 Sample Output (Dry Run) #
📂 Using folder: /your/flutter/project
🧪 Performing dry run...
🗂️ Found 4 unused images:
assets/images/old_logo.png
assets/icons/unused_icon.svg
assets/images/temp/banner.jpg
assets/icons/trash.png
📁 Requirements #
- Flutter project with images stored under
assets/orimages/ - Image paths must be referenced directly in
.dartfiles as strings (no dynamic paths)
📌 Version #
Current: 0.0.5
Check pub.dev → image_cleaner_cli for latest.
👨💻 Maintainer #
Built with ❤️ by Sumit Dabral
🔗 GitHub #
github.com/I-SumitDabral/image_cleaner_cli
🧰 Use as a Dart Package #
You can also use image_cleaner_cli programmatically in your project:
In pubspec.yaml #
dependencies:
image_cleaner_cli: ^0.0.5
Then run: #
dart pub get
# or
flutter pub get
🔖 Tags #
flutter
dart
cli
image-cleaner
asset-cleaner
flutter-cli
flutter-asset
tooling
developer-tools
🙌 Support #
If this CLI saves you time and clutter, please consider:
- ⭐ Starring the project on GitHub
- 📢 Sharing it with fellow developers
- 🐛 Reporting issues or suggesting features