pack method
Writes input to buffer.
Implementation
@override
void pack(final BufferWriter buffer, final T? input) {
  if (input != null) {
    buffer.setUint(1, type.byteLength);
    subtype.pack(buffer, input);
  } else {
    buffer.setUint(0, type.byteLength);
  }
}