encodeTo method

  1. @override
void encodeTo(
  1. MapEntry<String, V?> value,
  2. Output output
)
override

Convert self to a slice and append it to the destination.

Implementation

@override
void encodeTo(MapEntry<String, V?> value, Output output) {
  if (_keyedIndex[value.key] == null) {
    throw EnumException(
        'Invalid enum value: ${value.key}. Can only accept: ${_keyedIndex.keys.join(', ')}');
  }

  final int palletIndex = _keyedIndex[value.key]!;

  output.pushByte(palletIndex);

  map[value.key]!.encodeTo(value.value, output);
}