encode method

Uint8List encode()

Encodes the chunk header to a Uint8List.

Implementation

Uint8List encode() {
  final ByteData data = ByteData(12);

  final Uint8List encodedChunkType = chunkType.encode();
  for (int i = 0; i < encodedChunkType.length; i++) {
    data.setUint8(i, encodedChunkType[i]);
  }

  data.setInt64(4, chunkSize);

  return data.buffer.asUint8List();
}