mek_assets 3.0.0-dev.4
mek_assets: ^3.0.0-dev.4 copied to clipboard
Automatically generate dart classes / flutter pubspec entries for your assets files.
Mek Assets #
Automatically generate dart classes from pubspec.yaml assets field entries.
Usage #
This package can be used as a script or with build_runner.
Script #
- Activate:
dart pub global activate mek_assets - Generate files with:
dart pub global run mek_assets
See script example
Build Runner #
- Add
build_runnerandmek_assetsto yourpubspec.yamldev_dependencies:dev_dependencies: build_runner: mek_assets: - Generate files with:
dart run build_runner build
See build_runner example and the build.yaml configuration.
Advance Package Usage #
In your build.yaml or pubspec.yaml file, you can configure the generator.
mek_assets:
# Directory where to save the generated files
output_directory: lib
# File name where to generate assets classes
output_file: assets.g.dart
# Name of the main class that contains the single assets. Defaults is "Assets" name.
# You can pass `false` to not create a class that contains the individual files.
single_assets_class: Assets
assets:
# Name of the class that contains the assets. Defaults is directory name.
<ASSET_PATH>: Images
# You can disable generation with `false` value
<ASSET_PATH_IGNORED>: false
Features and bugs #
Please file feature requests and bugs at the issue tracker.
Extra #
- index_generator: Automatically generate index / barrel files with all the exports needed for your library.
- mek_data_class: Generate
hashCode,==,toString,copyWithandchangemethods with low code.