IsolateManager<R, P>.create constructor
- IsolateFunction<
R, P> isolateFunction, { - String? workerName,
- String debugName = 'normal',
- int concurrent = 1,
- IsolateConverter<
R> ? converter, - IsolateConverter<
R> ? workerConverter, - QueueStrategy<
R, P> ? queueStrategy, - bool enableWasmConverter = true,
- bool enableWasmTransferables = false,
- bool isDebug = false,
Creates a new IsolateManager for isolate-based computations.
isolateFunction is the function to be run in each isolate.
Use workerName (or a pre-defined mapping in _workerMappings) to utilize
a named worker JS file on the Web.
concurrent decides how many isolates to spawn.
Transforms results using converter and workerConverter before returning them.
When enableWasmConverter is true (default), the int type is automatically
converted back to its intended type during message passing between web workers.
This ensures proper type handling in WebAssembly environments.
The conversion pipeline applies WASM conversions first, then passes results through any custom converter functions provided.
When enableWasmTransferables is false (default), transferables are omitted
when targeting WebAssembly (WASM) to avoid unnecessary overhead, as WASM does not
benefit from zero-copy transfers. Set to true to force the use of transferables
even on WASM.
Control the Queue strategy via queueStrategy with the following basic
strategies:
isDebug enables debug logs when set to true.
Implementation
IsolateManager.create(
IsolateFunction<R, P> this.isolateFunction, {
String? workerName,
String debugName = 'normal',
this.concurrent = 1,
this.converter,
this.workerConverter,
QueueStrategy<R, P>? queueStrategy,
this.enableWasmConverter = true,
this.enableWasmTransferables = false,
this.isDebug = false,
}) : isCustomIsolate = false,
queueStrategy = queueStrategy ?? UnlimitedStrategy(),
_debugName = debugName,
_workerName = normalizePath(workerName) {
IsolateContactor.debugLogPrefix = debugLogPrefix;
}