run<R> static method
Future<R>
run<R>(
- FutureOr<
R> computation(), - CancellationToken? cancellationToken, {
- String? debugName,
A cancellable implementation of Dart's Isolate.run
method.
Runs computation
in a new isolate and returns the result. When
cancelled, the isolate is killed.
When building for web, this uses CancellableFuture.from as a fallback due to isolates not being supported.
Implementation
static Future<R> run<R>(
FutureOr<R> Function() computation,
CancellationToken? cancellationToken, {
String? debugName,
}) =>
runImpl(computation, cancellationToken, debugName: debugName);