Automatically generate dart classes / flutter pubspec entries for your assets files.
dart/flutter pub global activate mek_assets
mek_assets.yamlfile or add in your
mek_assets: # It supports generating assets in a `single` class, into `multi` classes based on directory or `tree` classes structure based on directory format: multi # single, multi, tree # The various assets groups groups: # Path of assets - input_dir: assets prefix_class_name: R output_file_name: r
- Optional: Add these comments to
pubspec.yamlto automatically generate all the entries needed to flutter
flutter: assets: - ... # mek_assets GENERATED CODE - DO NOT MODIFY BY HAND - The auto generated code will be added here, copy paste this section # mek_assets
- You can generate index files with:
<dart|flutter> pub global run mek_assets build
Advance and Package Usage
index_generator: # The page width uses when the dart code is generated page_width: 80 # Add the package name to the paths of the assets package: awesome_assets groups: - input_dir: assets # Define what elements to include in the group, use Glob format include: # You can define specific export assets files - '**.png' # Define what elements to exlude in the group, use Glob format exclude: [ '**.svg' ] # Prefix of the classes that contains the assets. Defaults nothing. prefix_class_name: R # Name of the main class that contains the assets. Defaults input directory name. class_name: AwesomeAssets # Create a map of all items contained in the group create_map_files: true # Directory where to save the generated files. Defaults `lib` output_dir: lib/src # Generated file name. Defaults input directory name output_file_name: 'r'
Recommended format settings
Single / Tree
class_name: R output_file_name: r
prefix_class_name: R output_file_name: r
Features and bugs
Please file feature requests and bugs at the issue tracker.
- Support for doing something awesome.