run<T, R> static method

Future<R> run<T, R>({
  1. required R function(
    1. T
    ),
  2. required T message,
})

Runs a function in an isolate.

The function parameter is the function to run in the isolate. The message parameter is the data to pass to the function.

Returns the result of the function.

Implementation

static Future<R> run<T, R>({
  required R Function(T) function,
  required T message,
}) async {
  _log.fine('Running operation in isolate');
  return Isolate.run(() => function(message));
}