readUntil method

Uint8List readUntil(
  1. int byte
)

read bytes until a specific byte being seen the specific byte is not included

Implementation

Uint8List readUntil(int byte) {
  int startPosition = _currentPosition;
  while (_currentPosition < data.lengthInBytes &&
      data[_currentPosition] != byte) {
    _currentPosition++;
  }
  return Uint8List.sublistView(data, startPosition, _currentPosition);
}