unused_assets_removal 0.0.6 copy "unused_assets_removal: ^0.0.6" to clipboard
unused_assets_removal: ^0.0.6 copied to clipboard

A CLI tool to detect and optionally delete unused asset files in your Flutter project, helping you reduce app size and clean up unnecessary files.

🧹 unused_assets_removal #

A CLI tool to scan and delete unused asset files in your Flutter project. Optimize your app size and keep your project clean!


πŸš€ Features #

  • βœ… Detect unused image assets in your Flutter project.
  • πŸ—‘ Option to delete them automatically.
  • 🧠 Supports common asset usage patterns like AssetImage, Image.asset, etc.
  • ⚑ Fast, simple, and easy to use.

πŸ“¦ Installation #

Clone the repo locally and run it directly using Dart:

git clone https://github.com/3boodev/unused_assets_removal
cd unused_assets_removal
dart pub get

- OR ADD TO dev_dependencies in pubspec.yaml #

  dev_dependencies:
    unused_assets_removal:
     git:
      url: https://github.com/3boodev/unused_assets_removal

- OR USE It as Globally #

  dart pub global activate unused_assets_removal

πŸ›  Usage (with out 'dart run' If your Use Globally) #

  1. Detect unused assets
   dart run unused_assets_removal --dry-run
  1. Delete unused assets
   dart run unused_assets_removal --delete
  1. Change Assets path to your Flutter project
   dart run unused_assets_removal --assets-path=assets/images
  1. Set Location of Assets report
   dart run unused_assets_removal --dry-run --log-path=report.txt

🧾CLI Options: #

Option | Alias | Description --path | -p | Path to your Flutter project (required) --delete | -d | Delete unused assets (optional) --help | -h | Show help menu

πŸ“ What It Scans #

  • Assets: All images defined under flutter/assets in your pubspec.yaml.
    • References: Any asset referenced using: AssetImage('assets/image.png') Image.asset('assets/image.png') ExactAssetImage('assets/image.png')
  • JSON or Dart files containing string references to assets.

❌ What It Does NOT Support (yet) #

Dynamic asset references (e.g., assets loaded by variable names). Localization-specific assets or platform-specific folders. Want to help improve it? Contributions are welcome! πŸ™Œ

βœ… Example #

   dart run unused_assets_removal

Output: #

Scanning assets... Found 38 assets Found 29 used assets Unused assets:

  • assets/images/old_logo.png
  • assets/icons/temp_icon.png

To delete them: #

dart run unused_assets_removal --delete

πŸ“Œ Roadmap #

  • Detect unused fonts and other resource types.
  • Integration with CI pipelines.
  • Configurable exclusion rules.

πŸ‘¨β€πŸ’» Author #

πŸ“ License #

  • This project is licensed under the MIT License. See the LICENSE file for details.
2
likes
130
points
295
downloads

Publisher

unverified uploader

Weekly Downloads

A CLI tool to detect and optionally delete unused asset files in your Flutter project, helping you reduce app size and clean up unnecessary files.

Repository (GitHub)

Topics

#flutter #cli #assets #cleanup #optimization

Documentation

API reference

License

MIT (license)

Dependencies

args, path

More

Packages that depend on unused_assets_removal