asset_hound 1.0.1 copy "asset_hound: ^1.0.1" to clipboard
asset_hound: ^1.0.1 copied to clipboard

A CLI tool to sniff out and remove unused assets in Flutter projects.

Asset Hound Logo

Asset Hound 🐶

A lightning-fast CLI tool to sniff out and remove unused assets in your Flutter projects.

Pub Version License: MIT


🧐 The Problem #

As Flutter apps grow, developers often leave behind unused images, fonts, and SVGs. These "ghost assets" bloat your final APK/IPA size, hurting your app's download conversion rate.

Asset Hound automatically scans your pubspec.yaml, searches your file system, and analyzes your Dart code to find exactly which assets are wasting space—allowing you to safely delete them and generate beautiful savings reports.


🚀 Quick Start #

Asset Hound is designed to be run globally from your terminal. Activate it once:

dart pub global activate asset_hound

Navigate to your Flutter project and let the hound off the leash:

dart run asset_hound scan

🛠️ Usage & Commands #

Run the scan command to analyze your project. You can customize the scan using various flags:

Flag Abbreviation Description
--report=<format> -r Generates a savings report. Supported formats: html, json.
--auto-fix -f (Caution) Automatically deletes the unused assets found during the scan.
--yes -y Skips the confirmation prompt when using --auto-fix. Great for CI/CD.
--dry-run -d Simulates an auto-fix deletion without actually harming any files.
--scope=<list> -s Comma-separated list of scopes to scan (pubspec, assets, code).
--verbose -v Prints detailed logging information. Great for debugging.
--protect=<list> -p Comma-separated list of native config packages to protect from deletion.

Example 1: Generate a beautiful HTML dashboard of your unused assets:

dart run asset_hound scan --report=html

Example 2: Run an automated cleanup in a CI/CD pipeline (no prompts):

dart run asset_hound scan --auto-fix --yes

⚙️ Configuration (Optional) #

Asset Hound is smart enough to handle dynamically generated paths (like assets/icons/icon_$index.png) using fuzzy directory matching. However, if you need to explicitly ignore certain directories, you can configure it directly in your pubspec.yaml.

Add an asset_hound block to the bottom of your file:

# pubspec.yaml

asset_hound:
  ignore:
    # Ignore all videos
    - assets/videos/**
    # Ignore a specific file
    - assets/images/do_not_delete.png

Native Package Protection #

By default, Asset Hound automatically protects native assets configured by popular packages (like flutter_native_splash and flutter_launcher_icons). If you use custom packages, you can protect them via the CLI:

dart run asset_hound scan --protect=my_custom_splash,other_icons

🤝 Contributing #

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

1
likes
160
points
60
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A CLI tool to sniff out and remove unused assets in Flutter projects.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

args, glob, mason_logger, path, yaml

More

Packages that depend on asset_hound