writeVarUint method

void writeVarUint(
  1. int value
)

Writes variable-length unsigned integer.

Implementation

void writeVarUint(int value) {
  if (value < 0) {
    throw new ArgumentError.value(value);
  }
  while (true) {
    final byte = 0x7F & value;
    final nextValue = value >> 7;
    if (nextValue == 0) {
      writeUint8(byte);
      return;
    }
    writeUint8(0x80 | byte);
    value = nextValue;
  }
}