π§Ό 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