isolate_runner_mixin library

A Flutter-aware mixin for running CPU-intensive tasks and persistent background workers off the main UI isolate with cooperative Web and WebAssembly (WASM) fallback.

Classes

SpawnWorkerOptions
Options for spawned worker behavior.

Enums

IsolateRunMode
Controls where IsolateRunnerMixin.runInIsolate executes a task.
WorkerState
Internal state of a worker runner.

Mixins

IsolateRunnerMixin
A mixin providing background execution and persistent worker patterns.

Functions

isAllowedPayload(Object? value, [Set<Object>? seen]) → bool
Validates whether a value is sendable across isolates or meets payload contracts.

Typedefs

IsolateWorkerHandler = FutureOr<Object?> Function(String command, Object? payload)
Worker request handler used by IsolateRunnerMixin.spawnWorker.

Exceptions / Errors

IsolateWorkerDisposedException
Thrown when the worker isolate is disposed while requests are pending.
IsolateWorkerException
Base exception type for spawned worker operations.
IsolateWorkerNotInitializedException
Thrown when a request is attempted before a worker handler is registered.
IsolateWorkerPayloadException
Thrown when request payload/result does not satisfy the package payload contract.
IsolateWorkerQueueOverflowException
Thrown when pending request count exceeds SpawnWorkerOptions.maxPendingRequests.
IsolateWorkerRemoteException
Thrown when a worker handler request fails in the worker isolate.
IsolateWorkerTerminatedException
Thrown when the worker isolate terminates unexpectedly.