IsolateRunner<T> constructor

IsolateRunner<T>(
  1. FutureOr<T> computation(), {
  2. CancellationToken? token,
})

Creates an instance of IsolateRunner.

Parameters:

  • computation: A callback that represents a computation.
  • token: Cancellation token used for canceling the execution of computation.

If the token parameter is specified, it can be retrieved in the computation] body by calling Task.token.
Token-based cancellation is a very flexible cancellation method, implemented solely based on the cancellation request processing logic.

Implementation

IsolateRunner(
  FutureOr<T> Function() computation, {
  CancellationToken? token,
})  : _computation = computation,
      _token = token;