close method

  1. @override
void close()
inherited

Closes the channel which means no more puts will be allowed. All pending takers will be invoked with End.

Implementation

@override
void close() {
  if (_isDebugMode) {
    _checkForbiddenStates();
  }

  if (_closed) {
    return;
  }

  _closed = true;

  if (onClose != null) onClose!();

  var takers = (_currentTakers = _nextTakers);

  _nextTakers = [];

  takers.forEach((taker) {
    taker._onData(End as T);
  });
}