generic_enum_annotation 0.1.7 copy "generic_enum_annotation: ^0.1.7" to clipboard
generic_enum_annotation: ^0.1.7 copied to clipboard

discontinued

Defines annotations processed by source code generating library generic_enum_builder.

Generic Enum Annotation #

Build Status

Update #

As of generic_enum version 0.2.2, the package generic_enum_annotation is no longer required as a dependency when building a generic enum.

Introduction #

This library defines annotations used to annotate classes that extend GenericEnum.

GenericEnum is a base class for creating generic classes with a fixed set of static constant instances. These classes appear to the user like a Dart enumeration. For example, generic enums can be used in switch statements, to initialize variables, or as default parameters in functions and constructors.

The annotations defined in this library are:

  • @GenerateValueMap(): Requests the generation of an unmodifiable map _$<ClassName>ValueMap containing the enum values and const static instances.
  • @GenerateFromJson(): Requests the generation of the private function _$<ClassName>FromJson and the generation of _$<ClassName>ValueMap. Note: A ToJson function is already provided by the base class generic_enum.
  • @GenerateIdentifier(): Requests the generation of the private function _$<ClassName>Identifier. The function can be use to retrieve the identifier of each defined const generic enum instance.

Usage #

To use this library include generic_enum and generic_enum_annotation 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.

Examples #

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.

0
likes
30
pub points
0%
popularity

Publisher

verified publishersimphotonics.com

Defines annotations processed by source code generating library generic_enum_builder.

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on generic_enum_annotation