close method

  1. @override
Future<void> close()
override

Stop the runner.

If the runner has allocated resources, e.g., an isolate, it should be released. No further calls to run should be made after calling stop.

Implementation

@override
Future<void> close() {
  var stopFuture = _stopFuture;
  if (stopFuture != null) return stopFuture;
  var queue = _queue;
  var length = _length;
  _queue = _emptyQueue;
  _length = 0;
  return _stopFuture = MultiError.waitUnordered(
    [for (var i = 0; i < length; i++) queue[i].close()],
  ).then(ignore);
}