remaining method

Stream<Uint8List> remaining()

Give a stream containing our as-yet-unread bytes.

Implementation

Stream<Uint8List> remaining() async* {
  if (_curr != null && _pos < _curr!.length) {
    yield await readBytesImmutable(_curr!.length - _pos);
  }
  while (true) {
    if (!await _source.moveNext()) {
      break;
    }
    if (_source.current is Uint8List) {
      yield _source.current as Uint8List;
    } else {
      yield Uint8List.fromList(_source.current);
    }
  }
  // No need to close, because a StreamIterator cancels when
  // moveNext completes with false or error.
}