toRaw method

Uint8List toRaw({
  1. Endian endian = Endian.big,
})
override

Serializes this Serializable to a Uint8List.

Implementation

Uint8List toRaw({Endian endian = Endian.big}) {
  Uint8List buffer = Uint8List(5 + serializedSize);
  SerializableOutput output = SerializableOutput(buffer);
  output.addUint32(buffer.length - 4);
  output.addUint8(id);
  serialize(output);
  if (!output.done) {
    throw FormatException('${output.offset}/${output.buffer.length}');
  }
  return buffer;
}