run<TArg, TProgress, TResult> static method
Future<TResult>
run<TArg, TProgress, TResult>(
- Future<
TResult> task(- TArg arg,
- void emit(
- TProgress
- TArg arg, {
- void onProgress(
- TProgress
Spawns an isolate, runs task, and returns its result.
onProgress fires on the calling isolate each time the task calls its
emit callback. Throws KIsolateException on spawn failure or an
uncaught exception inside task.
Implementation
static Future<TResult> run<TArg, TProgress, TResult>(
Future<TResult> Function(TArg arg, void Function(TProgress) emit) task,
TArg arg, {
void Function(TProgress)? onProgress,
}) => KIsolate<TArg, TProgress, TResult>._()._execute(task, arg, onProgress: onProgress);