flush method Null safety

void flush()

Write any remaining bits from the buffer to the output, padding the remainder of the byte with 0's.

Implementation

void flush() {
  if (_bitPos != 8) {
    writeBits(_bitPos, 0);
  }
}