runIsolated<T> abstract method

Future<T> runIsolated<T>(
  1. SodiumIsolateCallback<T> callback, {
  2. List<SecureKey> secureKeys = const [],
  3. List<KeyPair> keyPairs = const [],
})

Runs the given callback with an isolate.

This method can be used to run computation heavy tasks within a separate isolate.

Important: SecureKeys and KeyPairs cannot be passed to the isolate via context. Instead you have to pass them as array via the secureKeys and keyPairs parameters to this method and can then retrieve them via the secureKeys and keyPairs arguments of the callback. They will be passed to the callback in the same order in that they were passed to the arguments of this method.

In case you need more control over the isolates, you can use isolateFactory to get a factory method that can be passed between isolates.

Implementation

Future<T> runIsolated<T>(
  SodiumIsolateCallback<T> callback, {
  List<SecureKey> secureKeys = const [],
  List<KeyPair> keyPairs = const [],
});