fromJson method

  1. @override
O fromJson(
  1. Object? json
)
override

Returns an Enum instance from json.

See from.

Implementation

@override
O fromJson(Object? json) {
  if (json == null) {
    throw StateError("Null JSON for enum: $enumName");
  }

  var o = from(json);
  if (o == null) {
    throw StateError("No enum `$enumName` for JSON: $json");
  }

  return o;
}