putBit method

void putBit(
  1. bool bit
)

Implementation

void putBit(bool bit) {
  final bufIndex = _length ~/ 8;
  if (_buffer.length <= bufIndex) {
    _buffer.add(0);
  }

  if (bit) {
    _buffer[bufIndex] |= 0x80 >> (_length % 8);
  }

  _length++;
}