close method

Future close()

Indicates that no more branches will be requested via split.

This clears the internal buffer of events. If there are no branches or all branches have been canceled, this cancels the subscription to the input stream.

Returns a Future that completes once all events have been processed by all branches and (if applicable) the subscription to the input stream has been canceled.


Future close() {
  if (_isClosed) return _closeGroup.future;
  _isClosed = true;

  if (_controllers.isEmpty) _cancelSubscription();

  return _closeGroup.future;