assets_generator
5.0.1, released 3 months ago by fluttercandies.com
Automatically generates asset configs in YAML and Dart constants for single projects and modules.
What it does
The tool scans asset folders and automatically updates pubspec.yaml configurations. It also generates Dart constant classes to reference your assets safely across your application.
AI-written summary of version 5.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to avoid manually typing asset paths in pubspec.yaml
- You want type-safe constants for accessing assets in Flutter
Skip it when
- You prefer manually managing asset entries and strings
Strengths
- Automatically updates YAML configs
- Generates Dart constants with customizable naming rules
- Supports multi-module projects and workspaces
Weaknesses
- Requires global tool activation and path configuration
- Relies on external CLI execution rather than a build_runner dependency
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 11
Activate globally via pub and add the pub bin path to your system path.
Image.asset(Assets.assets_images_xxx_jpg);Alternatives
Packages that do the same job and could replace assets_generator.
- data_class_plugin
A tool that uses Dart's Analyzer to generate data classes, unions, and enums.
71Compare - pubspec_extract
Extracts Dart pubspec.yaml file and generates pubspec.dart at build time
75Compare - serverpod_cli
Command line tools for Serverpod.
74Compare - spider
A Dart command-line tool for generating type-safe Dart references for assets.
63Compare
Works with
Packages commonly used together with assets_generator: ones it builds on, ones built on it, and its own family.
- analyzerassets_generator depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlassets_generator depends on itA Dart library for parsing YAML documents into Dart data structures.
- pub_semverassets_generator depends on itVersions and version constraints implementing pub's versioning policy.
- mimeassets_generator depends on itUtilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.
- package_configassets_generator depends on itRead and write Dart package configuration files.
- ioassets_generator depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- dart_styleassets_generator depends on itProvides an API and CLI to format Dart source code automatically.
- source_spanassets_generator depends on itStandard representation for source code locations, spans, and human-friendly error messages.