mek_assets 1.1.0 copy "mek_assets: ^1.1.0" to clipboard
mek_assets: ^1.1.0 copied to clipboard

Automatically generate dart classes / flutter pubspec entries for your assets files.

Mek Assets #

Automatically generate dart classes / flutter pubspec entries for your assets files.

Usage #

  1. Activate: dart/flutter pub global activate mek_assets

  2. Create mek_assets.yaml file or add in your pubspec.yaml file:

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
  1. Optional: Add these comments to pubspec.yaml to 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
  1. 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'

Single / Tree #

      class_name: R
      output_file_name: r

Multi #

      prefix_class_name: R
      output_file_name: r

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, copyWith and change methods with low code.
2
likes
130
points
99
downloads

Publisher

unverified uploader

Weekly Downloads

Automatically generate dart classes / flutter pubspec entries for your assets files.

Repository (GitHub)
View/report issues

Topics

#assets #assets-generator #code-gen

Documentation

API reference

License

MIT (license)

Dependencies

args, checked_yaml, cli_util, code_builder, collection, dart_style, file, glob, json_annotation, path, recase, yaml

More

Packages that depend on mek_assets