compute<M, R> static method

Future<R> compute<M, R>(
  1. R fn(
    1. M
    ),
  2. M message
)

Convenience: run a simple synchronous function in an isolate.

Implementation

static Future<R> compute<M, R>(R Function(M) fn, M message) async {
  return Isolate.run(() => fn(message));
}