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!
- π Detect unused images in your Flutter project's
assets/
folder by default (e.g., runningimage_cleaner_cli example
will 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
dart pub global activate image_cleaner_cli
Then run the tool from anywhere:
image_cleaner_cli
π Make sure your Dart
bin
path (e.g.,~/.pub-cache/bin
) is in your system'sPATH
.
dart pub global activate image_cleaner_cli <version>
Example:
dart pub global activate image_cleaner_cli 0.0.5
Clone or open your local project and run:
dart run bin/image_cleaner_cli.dart
image_cleaner_cli /path/to/your/flutter/project
Or, when running locally:
dart run bin/image_cleaner_cli.dart /path/to/your/flutter/project
<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
Flag | Alias | Description |
---|---|---|
--dry-run |
-d |
Preview unused images (no deletion) |
--help |
-h |
Display help and usage info |
- 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
.dart
files. - 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.
π 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
- Flutter project with images stored under
assets/
orimages/
- Image paths must be referenced directly in
.dart
files as strings (no dynamic paths)
Current: 0.0.5
Check pub.dev β image_cleaner_cli for latest.
Built with β€οΈ by Sumit Dabral
github.com/I-SumitDabral/image_cleaner_cli
You can also use image_cleaner_cli
programmatically in your project:
dependencies:
image_cleaner_cli: ^0.0.5
dart pub get
# or
flutter pub get
flutter
dart
cli
image-cleaner
asset-cleaner
flutter-cli
flutter-asset
tooling
developer-tools
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