put method

  1. @override
void put(
  1. dynamic message
)
inherited

Used to put message on the buffer. The put will be handled using the following rules

  • If the channel is closed, then the put will have no effect.
  • If there are pending takers, then invoke the oldest taker with the message.
  • Otherwise put the message on the underlying buffer

Implementation

@override
void put(message) {
  if (_isDebugMode) {
    _checkForbiddenStates();
    if (message == null) {
      throw NullInputError();
    }
  }

  if (_closed) {
    return;
  }

  if (_takers.isEmpty) {
    return _buffer.put(message);
  }

  var takeCallback = _takers.removeAt(0);
  takeCallback._onData(message);
}