IsolateManager<R, P>.createCustom constructor
- IsolateCustomFunction isolateFunction, {
- String? workerName,
- String debugName = 'custom',
- 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 instance with a custom isolate function.
isolateFunction is the user-defined 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:
Set isDebug to true to enable debug logs.
Implementation
IsolateManager.createCustom(
IsolateCustomFunction this.isolateFunction, {
String? workerName,
String debugName = 'custom',
this.concurrent = 1,
this.converter,
this.workerConverter,
QueueStrategy<R, P>? queueStrategy,
this.enableWasmConverter = true,
this.enableWasmTransferables = false,
this.isDebug = false,
}) : isCustomIsolate = true,
queueStrategy = queueStrategy ?? UnlimitedStrategy(),
_debugName = debugName,
_workerName = normalizePath(workerName) {
// Set the debug log prefix.
IsolateContactor.debugLogPrefix = debugLogPrefix;
}