squadron_local_worker library

Classes

BaseDevSquadronLogger
Base class for dev loggers.
BaseSquadronLogger
Base class for simple loggers
CancellationToken
Base cancellation token.
Channel
A Channel supports communication from a client to a platform worker. It is used to send a WorkerRequest to a platform worker.
ConsoleSquadronLogger
Simple console logger (print function)
DevSquadronLogger
Simple logger based on dart:dev log function
GenericMarshaller<T>
Base class to abstract S in SquadronMarshaller<T, S>.
IdentityMarshaller<T>
Identity marshaller.
LocalWorker<W extends WorkerService>
Base local worker class.
LocalWorkerClient
Base class used to communicate with a LocalWorker.
ParentSquadronLogger
Logger for workers, forwarding log messages to parent
Squadron
Squadron singleton. The main application thread and each worker thread will have their own private Squadron singleton.
SquadronLogger
Basic interface for logging
SquadronLogLevel
Log level constants, compatible with package:logging
SquadronMarshaller<T, S>
Base class to serialize/deserialize data of type T to a transferable type S.
WorkerChannel
A WorkerChannel supports communication from a platform worker to the client that posted the WorkerRequest. It is used to send WorkerResponse back to the client.
WorkerRequest
Class used to communicate from a Channel to the Worker. Typically a WorkerRequest consists of a command ID and a list of arguments. The command ID is used by the Worker to dispatch the WorkerRequest to the method responsible for handling it. The WorkerRequest is effectively sent to the Worker by calling the WorkerRequest.send or WorkerRequest.stream method. These methods will serialize the WorkerRequest as a Map to be transfered from the client to the worker and contains:
WorkerResponse
Class used to communicate from a Worker to clients. WorkerResponses are used to provide individual results to the client. Future-based services simply return a single WorkerResponse with the result. Streaming services will return one WorkerResponses for each stream item and mmust send a WorkerResponse.endOfStream message to indicate completion. WorkerResponses can also send error messages.
WorkerService
Base class for a worker service.

Functions

run(WorkerInitializer initializer, [Map? command, SquadronLogger? logger]) → void
Instantiates a WorkerService via the initializer and installs the service in a platform worker. The command argument is ignored on Web platforms. On native platforms, the command argument must be set to the Isolate's startup parameter.

Typedefs

CommandHandler = FutureOr Function(WorkerRequest req)

Exceptions / Errors

CancelledException
Exception to keep track of task cancellation.
SquadronError
Squadron Error
SquadronException
Base abstract class for exceptions in Squadron.
TaskTimeoutException
Exception to keep track of task timeouts.
WorkerException
Exception to keep track of errors encountered in a worker.