encode method

Uint8List encode()

Implementation

Uint8List encode() {
  final payloadData = payload.encode();

  final byteData = ByteData(4);
  byteData.setInt32(0, payloadData.lengthInBytes, Endian.little);
  byteData.setInt8(3, sequenceID);

  final buffer = ByteDataWriter(endian: Endian.little);
  buffer.write(byteData.buffer.asUint8List());
  buffer.write(payloadData);

  return buffer.toBytes();
}