writeByte method
Writes a byte to the current position in the buffer and advances the position within the buffer by one byte.
Implementation
void writeByte(int byte) {
  if (buffer!.length == _position) {
    buffer!.add(byte);
  } else {
    buffer![_position] = byte;
  }
  _position++;
}