split method

Stream<T> split()

Returns a single-subscription stream that's a copy of the input stream.

This will throw a StateError if close has been called.


Stream<T> split() {
  if (_isClosed) {
    throw StateError("Can't call split() on a closed StreamSplitter.");

  var controller = StreamController<T>(
      onListen: _onListen, onPause: _onPause, onResume: _onResume);
  controller.onCancel = () => _onCancel(controller);

  for (var result in _buffer) {

  if (_isDone) {
  } else {

  return controller.stream;