Skip to content

juancastillo0/template_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate files from Dart code annotations and Mustache templates

Features

  • Generate files from Dart code annotations and Mustache templates

Getting started

Install dependencies:

dev_dependencies:
  build_runner:
  mustache_generator:
    git:
      url: https://github.com/juancastillo0/template_generator

Usage

Create a Mustache template within the lib directory (lib/templates/fieldsEnum.mustache):

enum {{name}}Fields {
{{# fields }}
  {{ name }},
{{/ fields }}
}

Create and annotate your model:

@FieldsEnumTemplate()
class Model {
  final String fieldName;

  const Model({
    required this.fieldName,
  });
}

Run the code generator:

dart pub run build_runner watch --delete-conflicting-outputs

This will generate the following file:

enum ModelFields {
    fieldName,
}

You can check out the /example folder for a complete example.

Additional information

TODO: Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.

About

Generate files from Dart code annotations and Mustache templates

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published