writeUint8 method

void writeUint8(
  1. int number
)

Writes number as Uint8 to the sink. If the number is outside valid Uint8 range, it is capped at the appropriate boundary before writing.

Implementation

void writeUint8(int number) {
  // Trim the number at Uint8 boundaries.
  var n = max<int>(0, number.sign * min<int>(number.abs(), (1 << 8) - 1));

  // Write the trimmed number to the sink.
  writeBytes([n]);
}