๐งผ 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 - ๐งช 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.3
โถ๏ธ 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 --folder /path/to/your/flutter/project
Or, when running locally:
dart run bin/image_cleaner_cli.dart --folder /path/to/your/flutter/project
โ๏ธ CLI Options
| Flag | Alias | Description |
|---|---|---|
--dry-run |
-d |
Preview unused images (no deletion) |
--folder |
Set root directory to scan (optional) | |
--help |
-h |
Display help and usage info |
๐ How It Works
- Scans your
assets/directory. - 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/ - Image paths must be referenced directly in
.dartfiles as strings (no dynamic paths)
๐ Version
Current: 0.0.4
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.4
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