daassets 1.2.0
daassets: ^1.2.0

Dart native js
Flutter Android iOS web

A Dart package to automatically generate a class containing references to all assets in your project.

Daassets #

A Dart package to automatically generate a class containing references to all assets in your project.

Installation #

Add the following dependencies to your pubspec.yaml:

dev_dependencies:
  daassets: ^1.2.0

Example #

Define your assets

In your pubspec.yaml file:

flutter:

  assets:

    - assets/icon/            # imports all files in that directory
    - assets/icon/close.png   # imports that specific file

Generating Dart code

To generate the Dart file containing all assets, run the following command:

flutter pub pub run daassets:daassets.dart PUBSPEC_FILE_PATH OUTPUT_FILE_PATH

For example:

flutter pub pub run daassets:daassets.dart ./pubspec.yaml ./lib/assets.dart

Using generated code

The generated class contains static constants that you can use anywhere in your project.

Image.asset(Assets.ICON_CLOSE);
0
likes
100
pub points
24%
popularity

Publisher

mauriciotogneri.com

A Dart package to automatically generate a class containing references to all assets in your project.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

yaml

More

Packages that depend on daassets