ComputePool class abstract

A pool of isolate workers that will handle passed work. Using a compute pool will greatly reduce the dart isolate startup overhead

Compute pools will eagerly spin up the specified number of workers but will ensure that work can still be submitted in the startup phase.

Note: Isolates are only destroyed when calling shutdown Note: On web this falls back to using scheduleMicrotask

Constructors

ComputePool.createWith({int workersCount = 2})
Create a new compute pool with the requested number of worker isolates
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compute<Q, R>(ComputeCallback<Q, R> callback, Q message, {String? debugLabel}) Future<R>
Submit a task to be executed on an isolate in this pool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shutdown() → void
Shuts down the compute pool. Submitting new work will result in an error future being returned
toString() String
A string representation of this object.
inherited

Operators

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