rest property Null safety

Stream<T> rest

A stream of all the remaning events of the source stream.

All requested next, skip or take operations are completed first, and then any remaining events are provided as events of the returned stream.

Using rest closes this stream queue. After getting the rest the caller may no longer request other events, like after calling cancel.

Implementation

Stream<T> get rest {
  _checkNotClosed();
  var request = _RestRequest<T>(this);
  _isClosed = true;
  _addRequest(request);
  return request.stream;
}