EasyWorker class
Creates and spawns an isolate that shares the same code as the current isolate.
The argument entryPoint
specifies the initial function to call in the
spawned isolate. The entry-point function is invoked in the new isolate
with message
as the only argument.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isolate ↔ Isolate
-
The isolate instance attached to this worker.
latefinal
- isReady → bool
-
check if this isolate is ready to accept message.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stream → Stream
-
listen for any message from this worker
no setter
Methods
-
dispose(
) → void - dispose all the resources and close the worker
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMessage(
void onData(dynamic)?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription - listen for any message from this worker
-
pause(
) → void - Requests the isolate to pause.
-
resume(
) → void - Requests the isolate to resume again.
-
send(
dynamic message) → Future< void> - send message to this worker
-
toString(
) → String -
A string representation of this object.
inherited
-
waitUntilReady(
) → Future< void> - wait until this worker spawns
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
compute<
R, T> (WorkerEntrypoint< T> entrypoint, T payload, {String name = ""}) → Future<R> -
Spin up a short lived worker, execute the
entrypoint
and get the result