encode method

  1. @override
void encode(
  1. Uint8List data,
  2. LengthTrackingByteSink buffer
)
override

Writes data into the buffer.

Implementation

@override
void encode(Uint8List data, LengthTrackingByteSink buffer) {
  const UintType().encode(BigInt.from(data.length), buffer);

  final padding = calculatePadLength(data.length, allowEmpty: true);

  buffer
    ..add(data)
    ..add(Uint8List(padding));
}