Generic Enum Builder

Build Status


The package generic_enum_builder contains builders and source code generating classes based on source_gen and analyzer.

The provided builders can be configured to build GenericEnum classes supporting json-serialization.

Generic enumeration classes appear to the user like a Dart enum would. For example, generic enums can be used in switch statements, as annotations, to initialize variables, or as default parameters in functions and constructors.


To use this library include generic_enum as dependency in your pubspec.yaml file. Include generic_enum_builder and build_runner as dev_dependencies.

A step-by-step guide on how to build a generic enumeration is provided here.


The package generic_enum_example provides a complete example on how to define and build generic enumeration classes. As a starting point users could clone this repository, add their own generic enum classes to the folder lib and build the library.

Features and bugs

Please file feature requests and bugs at the issue tracker.


Library providing the builders mapBuilder and jsonBuilder. These functions are used to build generic enumeration classes extending GenericEnum<T>.