resources_generator 1.0.0 copy "resources_generator: ^1.0.0" to clipboard
resources_generator: ^1.0.0 copied to clipboard

An resource class generator for Flutter, like Android resource class R.

Resource generator #

Feature #

Generate a resource class from assets/ folder, similar to R class on Android.

Configurations #

This generator supports generate common assets folder and assets folder divided by flavors.

Without flavor #

Required structure for assets folder:

<your-project>
├── <assets-folder>/
   ├── images/ (for images)
   ├── vectors/ (for vector images or svg)
   ├── translations/ (for localizations)
   ├── fonts/ (for fonts)
   ├── scripts/ (for shell scripts)
   ├── configs/ (for JSON configurations)
   ├── raws/ (for raw files)
├── lib/
├── pubspec.yaml

With flavor #

Required structure for assets folder:

<your-project>
├── <assets-folder>/
   ├── all/ <common for all flavors>
      ├── images/ (for images)
      ├── vectors/ (for vector images or svg)
      ├── translations/ (for localizations)
      ├── fonts/ (for fonts)
      ├── scripts/ (for shell scripts)
      ├── configs/ (for JSON configurations)
      ├── raws/ (for raw files)
   ├── <flavor-0>
      ├── ... (same as all/)
   ├── <flavor-1>
      ├── ... (same as all/)
   ├── <flavor-2>
      ├── ... (same as all/)
   ├── ...
├── lib/
├── pubspec.yaml

Usage #

Activate the executable:

dart pub global activate resources_generator

cd into project root:

cd <your-project>

Execute the generator:

dart pub global run resources_generator:generate -i <assets-folder> -o <output-folder> -p <optional-package> -f

with:

  • -i or --input, optional, is the input assets folder, default to assets.
  • -o or --output, optional, is the output folder, default to lib/resources.
  • -p or --package, optional, is the package name if assets is in a package/module instead of an application..
  • -f or --with-flavor, optional, will generate the resource class into flavors.

Note #

  • For generating fonts, font file names must have this format: <family>-<attr-1>-<attr-2>.ttf, with attrs to be font style and font weight
    Example: Roboto-Italic-w600.ttf
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

An resource class generator for Flutter, like Android resource class R.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, path, yaml, yaml_edit

More

Packages that depend on resources_generator