encodeTo method

  1. @override
void encodeTo(
  1. A value,
  2. Output output
)
override

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

Implementation

@override
void encodeTo(A value, Output output) {
  final index = map.inverse[value];

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

  return output.pushByte(index);
}