asset_resolver
The asset_resolver
package helps you to generate a .dart file that contains all assets according to pubspec.yaml
.
Getting started
Install
dev_dependencies:
asset_resolver: any # Replace 'any' with version number.
build_runner: any # Optional.
Usage
flutter pub run build_runner build
More info about build_runner.
Options
flutter:
assets:
- assets/images/
asset_resolver:
output_class: Assets
output_path: lib/assets.dart
## Optional
# strip_field_prefix: assets
# ignore_dpr: true
# output_field_suffix: true
# field_style: camelCase
# package_name: example
output_class
: The output class name, defaultAssets
output_path
: Output file path, defaultlib/assets.dart
ignore_dpr
: Whether to ignore dpr folders, such as1.5x
,2.0x
,3.0x
output_field_suffix
: Whether the field name contains a suffix name, such asPNG
,JSON
strip_field_prefix
: Intercept the prefix of the field name. for example:assets/images/a.png
, intercept toassets
; the final generated name isimages_a_png
field_style
: The style of field naming; SupportcamelCase
,underScoreCase
; DefaultcamelCase
package_name
: If it is a package, the resulting path is:packages/{package_name}/{asset_path}