fromJSON method

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

Implementation

@override
Object? fromJSON(dynamic jsonValue, DeserializationContext context) {
  dynamic convert(value) => _enumDescriptor!.values.firstWhere(
      (eValue) => eValue.toString() == value.toString(),
      orElse: () => null);
  return jsonValue is Iterable
      ? jsonValue.map(convert).toList()
      : convert(jsonValue);
}