serialize method

Uint8List serialize()

Serialize to bytes

Implementation

Uint8List serialize() {
  final bytes = <int>[];

  // Type (4 bytes, little endian)
  bytes.add(type & 0xFF);
  bytes.add((type >> 8) & 0xFF);
  bytes.add((type >> 16) & 0xFF);
  bytes.add((type >> 24) & 0xFF);

  // Hash (32 bytes)
  bytes.addAll(hash.bytes);

  return Uint8List.fromList(bytes);
}