send method

void send(
  1. Request chunk
)

Sends a chunk of data back to the action.

No-op once the input side has been closed (e.g. after a cooperative cancel tears the session down): adding to a closed StreamSink throws a StateError, so a late send that races the close is silently dropped rather than crashing the caller.

Implementation

void send(Request chunk) {
  if (_inputSink == null) {
    throw GenkitException('Cannot send to this stream (external input)');
  }
  if (_inputClosed) return;
  _inputSink.add(chunk);
}