๐Ÿงผ 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

image_cleaner_cli 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 bin path (e.g., ~/.pub-cache/bin) is in your system's PATH.


๐Ÿ“Œ 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

  1. Scans your assets/ directory.
  2. Finds image files not referenced in any .dart files.
  3. Starts a local web server (http://localhost:8080).
  4. 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 .dart files 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