IsolateManager<R, P> class

Constructors

IsolateManager.create(IsolateFunction<R, P> isolateFunction, {String workerName = '', int concurrent = 1, IsolateConverter<R>? converter, IsolateConverter<R>? workerConverter, bool autoInitialize = true, bool isDebug = false})
An easy way to create a new isolate.
IsolateManager.createCustom(IsolateCustomFunction isolateFunction, {String workerName = '', Object? initialParams, int concurrent = 1, IsolateConverter<R>? converter, IsolateConverter<R>? workerConverter, bool autoInitialize = true, bool isDebug = false})
Create a new isolate with your own isolate function.
IsolateManager.createOwnIsolate(IsolateCustomFunction isolateFunction, {String workerName = '', Object? initialParams, int concurrent = 1, IsolateConverter<R>? converter, IsolateConverter<R>? workerConverter, bool autoInitialize = true, bool isDebug = false})
Create a new isolate with your own isolate function.

Properties

autoInitialize bool
Mark an Isolate and Worker as initialized after spawned.
final
concurrent int
Number of concurrent isolates.
final
converter IsolateConverter<R>?
Convert the result received from the isolate before getting real result. This function useful when the result received from the isolate is different from the return type.
final
ensureStarted Future<void>
If you want to call the start method manually without await, you can await later by using ensureStarted to ensure that all the isolates are started.
no setter
hashCode int
The hash code for this object.
no setterinherited
initialParams Object?
Initial parameters.
final
isCustomIsolate bool
Is using your own isolate function.
final
isDebug bool
Allow print debug log.
final
isolateFunction Object
Isolate function.
final
isStarted bool
To check if the start method is completed or not.
no setter
onMessage Stream<R>
Similar to stream, for who's using IsolateContactor.
no setter
queuesLength int
Get current number of queues.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<R>
Get value as stream.
no setter
workerConverter IsolateConverter<R>?
Convert the result received from the isolate before getting real result. This function useful when the result received from the isolate is different from the return type.
final
workerName String
Name of the Worker without the extension.
final

Methods

compute(P params, {IsolateCallback<R>? callback}) Future<R>
Compute isolate manager with R is return type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restart() Future<void>
Restart the isolate.
sendMessage(P params, {IsolateCallback<R>? callback}) Future<R>
Similar to the compute, for who's using IsolateContactor.
start() Future<void>
Initialize the instance. This method can be called manually or will be called when the first compute() has been made.
stop() Future<void>
Stop the isolate.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

debugLogPrefix String
Debug logs prefix.
getter/setter pair