Open Source CLI Tool

Stop editing pubspec.yaml files.

Drop files into assets/ and get everything updated automatically
Pubspec entries, type-safe Dart code, and more.

dart pub global activate dart_assets
Quick Start GitHub

Built for developers who
hate busywork

Seven commands. One tool. Every asset problem you've quietly tolerated—solved in seconds.

👁 01

Live Watcher

Add an image, delete a font, rename an icon—pubspec.yaml and your generated code gets updated in real time. No restarts.

⌨️ 02

Type-Safe Code Gen

Every asset gets a const String in a generated Dart file. Autocomplete supported & typos become compile errors.

📦 03

Image Optimization

Compress PNGs and JPEGs with one command. Configurable quality. Dry-run mode so you see savings before committing.

🔍 04

Unused Detection

Scans every .dart file in lib/ to find assets nobody references. Shows file sizes so you know what to cut first.

05

CI-Ready Checks

Missing files, stale generated code, oversized assets — check catches it all and returns non-zero so your pipeline breaks early.

🩺 06

Project Doctor

New to a project? doctor scans your setup — pubspec, assets folder, flutter config, generated code — and tells you exactly what's off.

One command, and your project stays in sync.

terminal
$

What gets generated

Every asset in your project becomes a type-safe constant. Drop a file in, reference it by name. The generated class updates automatically when you run watch or gen.

  • Autocomplete in your IDE
  • Compile-time error if an asset is renamed
  • All paths in one place
lib/gen/assets.dart
// GENERATED CODE - DO NOT MODIFY BY HAND

class Assets {
  Assets._();

  static const String logo = 'assets/images/logo.png';
  static const String banner = 'assets/images/banner.png';
  static const String homeIcon = 'assets/icons/home.svg';
  static const String config = 'assets/data.json';

  static const List<String> all = [
    logo, banner, homeIcon, config,
  ];
}

Up and running in 30 seconds

1

Install

dart pub global activate dart_assets
2

Watch

cd your_flutter_project && dart_assets watch
3

Build

Drop files into assets/. Pubspec updates. Code regenerates. Hot reload picks it up. And its all done!

All commands

dart_assets watch Watch assets folder, auto-update pubspec + code on changes
dart_assets gen One-time code generation for type-safe asset references
dart_assets optimize Compress images for production (supports --dry-run)
dart_assets unused Find assets not referenced anywhere in your Dart code
dart_assets clean Remove unused assets and update pubspec in one step
dart_assets check Validate everything — CI-friendly with proper exit codes
dart_assets doctor Diagnose common config issues and missing setup