fromData method

  1. @override
T fromData(
  1. Object value
)
override

Recreates an object from the given data representation.

If the value is not of the expected type, this must throw an UnexpectedTypeException.

Implementation

@override
T fromData(Object value) {
  if (value is! int) {
    throw UnexpectedTypeException(value: value, expectedTypes: [int]);
  }
  RangeError.checkValidIndex(
    value,
    values,
    'value',
    null,
    'not a valid enum index for $T',
  );
  return values[value];
}