GenerateValueExtension constructor
Annotation requesting the generation of the extension <EnumName>Value
.
valueType
: The type of the mapped enum values. Use the functiongetType<T>()
to pass a parameterized type e.g.valueType: getType<List<int>>()
.values
: The enum values of typevalueType
encoded as aString
.
Note: Value entries are copied verbatim to the getter. The values must represent a literal or a constant value. The number of entries must match the number of enum instances.
Values of type String
must be enclosed with escaped quotation marks!
Examples:
- Integer: {'0', '1', '2',}
- String: {'\'zero\'', '\'one\'', '\'two\'',}
- class A: {'const A(3.0)', 'const A(4.0)',}
Implementation
const GenerateValueExtension({
required this.valueType,
required this.values,
});