fromJSON method

  1. @override
Object? fromJSON(
  1. dynamic jsonValue,
  2. DeserializationContext context
)
override

Implementation

@override
Object? fromJSON(dynamic jsonValue, DeserializationContext context) {
  return jsonValue is int
      ? jsonValue < _enumDescriptor!.values.length && jsonValue >= 0
          ? (_enumDescriptor!.values as List)[jsonValue]
          : _enumDescriptor!.defaultValue
      : jsonValue;
}