interrupt method

void interrupt([
  1. R? result
])

If the channel hasn't completed yet, interrupt it and complete the result.

If the channel hasn't received a value yet, or timed out, it is stopped (like by a timeout) and the SingleResponseChannel.result is completed with result.

Implementation

void interrupt([R? result]) {
  _receivePort.close();
  _cancelTimer();
  if (!_completer.isCompleted) {
    // Not in event tail position, so complete the sync completer later.
    _completer.complete(Future.microtask(() => result));
  }
}