readByte method Null safety

int readByte()

Reads a byte from the buffer and advances the position within the buffer by one byte, or returns -1 if at the end of the buffer.

Implementation

int readByte() {
  final tmp = buffer![_position];
  if (_position <= (length - 1)) {
    _position++;
  } else {
    return -1;
  }
  return tmp;
}