IsolatePoolHelper class

A pool of isolates to handle tasks concurrently.

This helper allows running CPU-intensive or long-running tasks in isolates, efficiently distributing them across a fixed number of workers. Supports running arbitrary functions or Flint Dart request handlers.

Constructors

IsolatePoolHelper({int poolSize = 2})
Creates a new pool with the given poolSize. Defaults to 2 isolates if not specified.

Properties

hashCode int
The hash code for this object.
no setterinherited
poolSize int
Number of isolates in the pool.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

init() Future<void>
Initializes the pool by spawning the isolates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run<T, P>(Future<T> task(P params), P params, {Duration? timeout}) Future<T>
Runs a function task with parameters params in the isolate pool.
runRequest(Future<Response> handler(Request req), Request req, Response res, {Duration? timeout}) Future<void>
Runs a Flint Dart Request handler in an isolate.
toString() String
A string representation of this object.
inherited

Operators

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