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
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
taskwith parametersparamsin 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