fromJson<T extends Enum> static method
Creates a Label from a JSON map.
json - The JSON map containing 'label' and optionally 'customLabel'.
values - The list of enum values to decode the label from.
defaultValue - The default enum value to use if decoding fails.
Implementation
static Label<T> fromJson<T extends Enum>(
Map json,
List<T> values,
T defaultValue,
) {
return Label<T>(
JsonHelpers.decodeEnum(json['label'], values, defaultValue),
json['customLabel'] as String?,
);
}