AssetGenConfig class

Configuration for asset generation.

This class holds all configuration options for the asset generation process, including directories to scan, output settings, filtering options, and advanced features like watch mode and validation.

Example

final config = AssetGenConfig(
  roots: ['assets', 'images'],
  output: 'lib/generated/assets.dart',
  className: 'Assets',
  generateEnum: true,
  validatePubspec: true,
);

Constructors

AssetGenConfig({required List<String> roots, required String output, required String className, required List<String> exclude, required List<String>? includeExtensions, required String namingCase, required String sort, required bool groupByRoot, required bool addHeader, required bool generateMap, required String prefix, required bool watchMode, required bool generateEnum, required bool validatePubspec, required bool buildRunnerMode, String? pubspecPath})
Creates a new AssetGenConfig with the specified options.
AssetGenConfig.defaults()
Creates a default configuration with sensible defaults.
factory

Properties

addHeader bool
Whether to add a header comment to the generated file.
final
buildRunnerMode bool
Whether to run in build_runner mode.
final
className String
Name of the generated class or enum.
final
exclude List<String>
Patterns to exclude from asset generation.
final
generateEnum bool
Whether to generate enum output instead of class output.
final
generateMap bool
Whether to generate a map of all assets.
final
groupByRoot bool
Whether to group assets by root directory.
final
hashCode int
The hash code for this object.
no setterinherited
includeExtensions List<String>?
File extensions to include.
final
namingCase String
Naming case style for generated identifiers.
final
output String
Output file path for generated code.
final
prefix String
Prefix for all generated identifiers.
final
pubspecPath String?
Custom path to pubspec.yaml file.
final
roots List<String>
Directories to scan for assets.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sort String
Sort order for generated assets.
final
validatePubspec bool
Whether to validate assets against pubspec.yaml.
final
watchMode bool
Whether to enable watch mode.
final

Methods

copyWith({List<String>? roots, String? output, String? className, List<String>? exclude, List<String>? includeExtensions, String? namingCase, String? sort, bool? groupByRoot, bool? addHeader, bool? generateMap, String? prefix, bool? watchMode, bool? generateEnum, bool? validatePubspec, bool? buildRunnerMode, String? pubspecPath}) AssetGenConfig
Creates a copy of this configuration with the specified fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited