decode method

  1. @override
MapEntry<String, V> decode(
  1. Input input
)
override

Implementation

@override
MapEntry<String, V> decode(Input input) {
  final index = input.read();

  final type = map[index];

  if (type == null) {
    throw EnumException('Invalid enum index: $index.');
  }

  final codec = registry.getCodec(type);

  assertion(codec != null, 'Codec for type: $type not found.');

  return MapEntry(type, codec!.decode(input));
}