stable library
Stable, high-level Stem API.
New applications should prefer this library. The historical
package:stem/stem.dart barrel remains available for compatibility, while
low-level transport, signal, and instrumentation APIs are collected under
package:stem/advanced.dart.
Classes
- AtomicTerminalResultBackend
- Optional atomic terminal-state arbitration for result backends.
- BatchStatus
- Durable batch status projection derived from group metadata/results.
- BatchSubmission
- Handle returned when a batch is submitted.
- BroadcastDefinition
- Broadcast channel declaration.
- Broker
- Abstract broker compatibility facade implemented by queue adapters.
- BrokerCapabilities
- Runtime-declared capabilities of a broker adapter.
- BrokerCapabilitiesProvider
- Optional provider interface for adapters with capability declarations that are more precise than the legacy Broker getters.
- CalendarScheduleSpec
- Schedule specification that matches specific calendar attributes.
- Canvas
- A high-level API for composing and dispatching tasks.
-
ChordResult<
T extends Object?> - Result returned by Canvas.chord.
- ClockedScheduleSpec
- Schedule specification for a fixed, absolute run time.
-
CodecTaskPayloadEncoder<
T> - Bridges a PayloadCodec into the existing TaskPayloadEncoder contract.
- CronScheduleSpec
- Schedule specification for standard Cron expressions.
- DeadLetterBroker
- Optional broker capability for dead-letter inspection and replay.
- DeadLetterEntry
- Dead letter queue entry containing the failed envelope and metadata.
- DeadLetterPage
- Page of dead letter results with optional continuation offset.
- DeadLetterReplayResult
- Result describing entries considered for replay.
- DefaultQueueConfig
-
Default queue alias configuration tying
aliasto a canonical queue name. - EmitWorkflowEventRequest
- Workflow event emit request payload for isolate communication.
- EmitWorkflowEventResponse
- Response payload for isolate workflow event emit requests.
- EmitWorkflowEventSignal
- Request to emit a workflow event from an isolate.
- EnqueueTaskSignal
- Request to enqueue a task from an isolate.
- EventBus
- Distributes external events to workflow runs.
- ExponentialJitterRetryStrategy
- Exponential backoff with jitter, capped at a configurable duration.
- ExtendLeaseSignal
- Signals a request to extend a task lease.
- FakeWorkflowClock
- Controllable clock intended for tests.
- FencedLock
- A lock handle that carries a monotonically increasing fencing token.
-
Flow<
T extends Object?> - Convenience wrapper that builds a WorkflowDefinition using the declarative FlowBuilder DSL.
- FlowBuilder
- Builder used by Flow to capture workflow steps in declaration order.
- FlowContext
- Context provided to each workflow step invocation.
- FlowStep
- Node in a workflow Flow.
- FlowStepControl
- Control directive emitted by a workflow step to suspend execution.
- GroupDescriptor
- Descriptor for group (e.g., chord) aggregation.
-
GroupDispatch<
T extends Object?> - Handle returned by Canvas.group providing a stream of typed results.
- GroupStatus
- Aggregated status for a group/chord.
- HeartbeatSignal
- Signals a heartbeat from an executing task.
- InMemoryWorkflowRegistry
- In-memory WorkflowRegistry implementation for local runs and tests.
- InspectableBroker
- Optional broker capability for queue-depth inspection.
- IntervalScheduleSpec
- Schedule specification for fixed time intervals.
- LeaseBroker
- Optional broker capability for extending active delivery leases.
- Lock
- Handle to a lock acquired from a LockStore.
- LockStore
- Lock store used for unique jobs or scheduling coordination. Since: 0.1.0
- LockStoreFactory
- Factory for building LockStore instances.
- Middleware
- Middleware hook invoked for lifecycle events around enqueue/consume/execute. Since: 0.1.0
-
NoArgsTaskDefinition<
TResult> - Typed producer-facing definition for tasks that take no input args.
-
NoArgsWorkflowRef<
TResult extends Object?> - Typed producer-facing reference for workflows that take no input params.
- NoopWorkflowIntrospectionSink
- Default no-op sink for workflow step events.
-
PayloadCodec<
T> - Encodes and decodes a strongly-typed payload value.
- PayloadSigner
- Handles signing and verification of envelope payloads.
-
PayloadVersionRegistry<
T> - Registry of version-specific payload decoders for a single durable DTO type.
- ProgressSignal
- Signals a task progress update.
- QueueBinding
- Binding between a routing key (and optional headers) and a queue.
- QueueBroker
- Core queue operations required to publish and consume task deliveries.
- QueueDefinition
- Detailed queue definition with optional routing metadata.
- QueuePriorityRange
- Priority range constraint applied to a queue definition.
- RateLimit
- Typed rate-limit configuration shared across workers. Since: 0.3.0
- RateLimitDecision
- Result of attempting to acquire tokens from the rate limiter.
- RateLimiter
- Optional rate limiter interface shared across workers. Since: 0.1.0
- ResultBackend
- Result backend describes how task states are persisted and retrieved. Since: 0.1.0
- RetryStrategy
- Retry strategy used to compute the next backoff delay. Since: 0.1.0
- RevokeStoreFactory
- Factory for building RevokeStore instances.
- RouteDefinition
- Declarative routing rule mapping match criteria to targets.
- RouteMatch
- Routing match criteria with optional task glob, headers, or queue override.
- RouteTarget
- Route target describing queue or broadcast destination.
- RoutingConfig
- Canonical representation of routing configuration loaded from YAML or JSON.
- RoutingSubscription
- Subscription describing the queues and broadcast channels a worker should consume from.
- RunState
- Snapshot of a workflow run persisted by a WorkflowStore.
- ScheduleEntry
- Schedule entry persisted by a Beat-like scheduler.
- ScheduleSpec
- Base class for all scheduler specifications.
- ScheduleSpecKind
- Enumerates supported scheduler specification kinds.
- ScheduleStore
- Storage abstraction used by the scheduler to fetch due entries. Since: 0.1.0
- ScheduleStoreFactory
- Factory for building ScheduleStore instances.
- ScheduleTimezoneResolver
- Lazily resolves timezone identifiers.
- SigningConfig
- Configuration describing signing keys and behaviour.
- SolarScheduleSpec
- Schedule specification based on celestial/solar events.
- StartWorkflowRequest
- Workflow start request payload for isolate communication.
- StartWorkflowResponse
- Response payload for isolate workflow start requests.
- StartWorkflowSignal
- Request to start a workflow from an isolate.
- Stem
- Facade used by producer applications to enqueue tasks.
- StemApp
- Convenience bootstrap for setting up a Stem runtime with sensible defaults.
- StemBackendFactory
- Factory for building ResultBackend instances.
- StemBrokerFactory
- Factory for building QueueBroker instances.
- StemClient
- Shared entrypoint that owns broker/backend configuration for Stem runtimes.
- StemMemoryAdapter
-
Built-in adapter for in-memory stores using the
memory://scheme. - StemModule
- Generated or hand-authored bundle of tasks and workflow definitions.
- StemObserver
- Observer-only task result surface.
- StemProducer
- Producer-only task enqueue surface.
-
StemResourceFactory<
T> - Wrapper for constructing and disposing Stem resources lazily.
- StemStack
- Resolved factories for a Stem deployment stack.
- StemStoreAdapter
- Adapter that can resolve Stem store factories from a URL.
- StemStoreOverrides
- Optional URL overrides for specific store kinds.
- StemTaskApp
- Convenience bootstrap for setting up a Stem runtime with sensible defaults.
- StemWorkerConfig
- Worker configuration used by the bootstrap helpers.
- StemWorkerHost
- Worker lifecycle surface for a managed application runtime.
- StemWorkflowApp
- Helper that bootstraps a workflow runtime on top of StemApp.
- SystemWorkflowClock
- Default clock that proxies to DateTime.now.
-
TaskCall<
TArgs, TResult> - Represents a pending enqueue operation built from a TaskDefinition.
- TaskCancellationToken
- Cooperative cancellation state exposed to task code.
-
TaskChainResult<
T extends Object?> - Result returned by Canvas.chain.
- TaskContext
- Context passed to handler implementations during execution.
-
TaskDefinition<
TArgs, TResult> - Declarative task definition to build typed enqueue calls.
- TaskDefn
- Declares a function-backed task definition.
- TaskEnqueueOptions
- Options that apply only to the enqueue operation.
- TaskEnqueueRequest
- Enqueue request payload for isolate communication.
- TaskEnqueueResponse
- Response payload for isolate enqueue requests.
- TaskEnqueueScope
- Provides ambient metadata for task enqueue operations.
- TaskError
- Error metadata captured for failures.
- TaskExecutionContext
- Shared execution surface for task handlers and isolate entrypoints.
- TaskExecutionModeProvider
- Optional provider for handlers that explicitly declare their execution mode.
- TaskInvocationContext
- Context exposed to task entrypoints regardless of execution environment.
- TaskInvocationSignal
- Control messages emitted by task entrypoints running inside isolates.
- TaskMetadata
- Optional task metadata for documentation and tooling.
- TaskObserver
- Observation surface for task and group lifecycle state.
- TaskOptions
- Configuration options attached to task handlers.
-
TaskResult<
T extends Object?> - Typed view over a TaskStatus returned by helpers such as Stem.waitForTask or canvas typed operations.
- TaskResultCaller
- Shared typed task-dispatch surface used by producers, apps, and contexts.
- TaskRetryPolicy
- Retry policy configuration for tasks and publish attempts.
-
TaskSignature<
T extends Object?> - Describes a task to schedule along with optional decoder metadata.
- TaskStatus
- Canonical task record stored in the result backend.
- TaskStatusListRequest
- Query parameters used to list task status records.
- TaskStatusPage
- Paginated page of task status records.
- TaskStatusRecord
- Immutable record representing a persisted task status with timestamps.
-
TypedCanvasChain<
TInput, TCurrent extends Object?> - A fluent, heterogeneous typed Canvas chain.
-
TypedTaskHandler<
TArgs, TResult> - Typed task handler for the recommended manual registration path.
- WaitForWorkflowRequest
- Workflow wait request payload for isolate communication.
- WaitForWorkflowResponse
- Response payload for isolate workflow wait requests.
- WaitForWorkflowSignal
- Request to wait for a workflow from an isolate.
- Worker
- Worker runtime that consumes tasks from a broker and executes handlers.
- WorkerAutoscaleConfig
- Autoscaling configuration for worker concurrency.
- WorkerEvent
- An event emitted during worker operation.
- WorkerLifecycleConfig
- Lifecycle guard configuration for worker isolates and shutdown semantics.
- WorkflowAnnotations
- Collection of workflow-related annotations.
- WorkflowCaller
- Shared typed workflow-start surface used by apps, runtimes, and contexts.
- WorkflowCancellationPolicy
- Controls how the workflow runtime auto-cancels runs.
- WorkflowCheckpoint
- Declared script checkpoint metadata used for tooling and replay boundaries.
- WorkflowCheckpointView
- Uniform workflow checkpoint view for dashboard/CLI drilldowns.
- WorkflowClock
- Abstraction over time sources used by the workflow runtime and stores.
-
WorkflowDefinition<
T extends Object?> - Declarative workflow definition built via FlowBuilder or a higher-level script facade. Flow definitions capture an ordered execution plan. Script definitions capture a script body plus optional checkpoint metadata used for introspection and tooling.
- WorkflowDefn
- Declares a workflow definition class.
- WorkflowEdge
- Describes a directed edge between workflow steps.
- WorkflowEventBusFactory
- Factory for building workflow EventBus instances that depend on a store.
- WorkflowEventEmitter
- Shared typed workflow-event dispatch surface used by apps and runtimes.
-
WorkflowEventRef<
T> - Typed reference to a workflow resume event topic.
- WorkflowExecutionContext
- Shared execution context surface for flow steps and script checkpoints.
- WorkflowManifestCheckpoint
- Immutable manifest entry describing a declared script checkpoint.
- WorkflowManifestEntry
- Immutable manifest entry describing a workflow definition.
- WorkflowManifestFlowStep
- Immutable manifest entry describing a declared flow step.
-
WorkflowRef<
TParams, TResult extends Object?> - Typed producer-facing reference to a registered workflow.
- WorkflowRegistry
- Registry for workflow definitions keyed by name.
-
WorkflowResult<
T extends Object?> - Typed result returned by StemWorkflowApp.waitForCompletion.
- WorkflowResumeContext
- Shared suspension/resume surface implemented by flow steps and script checkpoints.
- WorkflowRun
- Marks a workflow class method as the run entrypoint.
- WorkflowRunDetailView
- Combined run + checkpoint drilldown view.
- WorkflowRunRuntimeMetadata
- Run-scoped runtime metadata persisted alongside workflow params.
- WorkflowRuntime
- Coordinates execution of workflow runs by dequeuing tasks, invoking steps, and persisting progress via a WorkflowStore.
- WorkflowRuntimeEvent
- Runtime orchestration event emitted by the workflow runtime.
- WorkflowRunView
- Uniform workflow run view tailored for dashboard/CLI drilldowns.
-
WorkflowScript<
T extends Object?> -
High-level workflow facade that allows scripts to be authored as a single
async function using
step,sleep, andawaitEventhelpers. - WorkflowScriptContext
- Runtime context exposed to workflow scripts. Implementations are provided by the workflow runtime so scripts can execute with durable semantics.
- WorkflowScriptStepContext
- Context provided to each script checkpoint invocation. Mirrors FlowContext but tailored for the facade helpers.
-
WorkflowStartCall<
TParams, TResult extends Object?> - Typed start request built from a WorkflowRef.
- WorkflowStep
- Marks a workflow class method as a durable step.
- WorkflowStepEntry
- Persisted step checkpoint metadata for a workflow run.
- WorkflowStepEvent
- Step-level execution event emitted by the workflow runtime.
- WorkflowStore
- Persistent storage for workflow runs, checkpoints, and suspensions.
- WorkflowStoreFactory
- Factory for building WorkflowStore instances.
- WorkflowWatcher
- Describes a workflow event watcher registered by the runtime.
- WorkflowWatcherResolution
- Represents a watcher that has been resolved (event delivered or timed out).
Enums
- BatchLifecycleState
- Lifecycle states for first-class batch submissions.
- BrokerDeliveryGuarantee
- Delivery guarantee advertised by a broker adapter.
- FlowControlType
- Enumerates the suspension control types.
- RateLimiterFailureMode
- Defines behavior when a limiter backend call fails.
- SigningAlgorithm
- Supported signing algorithms.
- StemStoreKind
- Store categories that can be resolved by adapters.
- TaskExecutionMode
- Selects the isolate in which a task handler executes.
- TaskState
- Logical task status across enqueue, running, success, failure states.
- WorkerEventType
- Types of events a worker can emit.
- WorkerShutdownMode
- Shutdown modes for workers.
- WorkflowChannelKind
- Logical channel used by workflow-related task enqueues.
- WorkflowContinuationReason
- Why a workflow continuation task was enqueued.
- WorkflowDefinitionKind
- Identifies whether a workflow is step-based or script-based.
- WorkflowKind
- Workflow definition type for annotated definitions.
- WorkflowRuntimeEventType
- Runtime-level workflow events emitted by orchestration transitions.
- WorkflowStatus
- Lifecycle state of a workflow run.
- WorkflowStepEventType
- Enumerates workflow step event types emitted by the runtime.
- WorkflowStepKind
- Kinds of workflow steps exposed for introspection.
Mixins
- WorkflowIntrospectionSink
- Sink for workflow step execution events.
Extensions
- BrokerCapabilitiesExtension on Broker
- Resolves capabilities without making Broker implementations add a new required member. External adapters therefore remain source-compatible and still receive a useful snapshot from the legacy getters.
- LockFencingTokenX on Lock
- Provides the fencing token when a lock implementation supports fencing.
-
NoArgsTaskDefinitionExtension
on NoArgsTaskDefinition<
TResult> - Convenience helpers for waiting on typed no-arg task definitions.
-
PayloadMapX
on Map<
String, Object?> - Typed read helpers for durable task-argument and workflow-parameter maps.
- QueueBrokerCapabilitiesExtension on QueueBroker
- Resolves capabilities for code that accepts the narrow QueueBroker type.
- QueueBrokerOptionalOperations on QueueBroker
- Optional operations for code that accepts the narrow QueueBroker type.
- StemAppWorkflowExtension on StemApp
- Convenience helpers for layering workflows onto an existing StemApp.
- StemStackClientBootstrap on StemStack
- Convenience helpers for bootstrapping clients from a resolved StemStack.
-
TaskDefinitionCanvasX
on TaskDefinition<
TArgs, TResult> - Convenience helpers for turning TaskDefinitions into signatures.
-
TaskDefinitionExtension
on TaskDefinition<
TArgs, TResult> - Convenience helpers for waiting on typed task definitions.
- TaskExecutionContextProgressX on TaskExecutionContext
- Shared task-progress helpers for execution contexts.
-
TaskHandlerExecutionModeX
on TaskHandler<
R> - Resolves the execution mode for a legacy or explicitly-declared handler.
- TaskStateX on TaskState
- Helpers for reasoning about task lifecycle states.
-
WorkflowEventRefExtension
on WorkflowEventRef<
T> - Convenience helpers for dispatching typed workflow events.
-
WorkflowEventRefWaitExtension
on WorkflowEventRef<
T> - Direct typed wait helpers on WorkflowEventRef.
- WorkflowExecutionContextParams on WorkflowExecutionContext
- Typed read helpers for workflow start parameters.
- WorkflowExecutionContextValues on WorkflowExecutionContext
- Typed read helpers for prior workflow step and checkpoint values.
-
WorkflowManifestDefinition
on WorkflowDefinition<
Object?> - Converts workflow definitions into typed manifest entries.
-
WorkflowRefExtension
on WorkflowRef<
TParams, TResult> - Convenience helpers for waiting on typed workflow refs using a generic WorkflowCaller.
- WorkflowResumeContextValues on WorkflowResumeContext
- Typed resume helpers for durable workflow suspensions.
- WorkflowScriptContextParams on WorkflowScriptContext
- Typed read helpers for workflow start parameters in script run methods.
- WorkflowScriptStepSuspensionJson on WorkflowScriptStepContext
- Low-level suspension helpers for workflow script checkpoints.
Constants
- signatureHeader → const String
- Header storing the base64 encoded payload signature.
- signatureKeyHeader → const String
- Header storing the signing key identifier used to calculate the signature.
- workflow → const WorkflowAnnotations
- Annotation namespace for workflow metadata.
- workflowParentRunIdParamKey → const String
- Reserved params key storing the parent workflow run identifier.
- workflowRunTaskName → const String
- Task name used for workflow run execution tasks.
- workflowRuntimeMetadataParamKey → const String
- Reserved params key storing internal runtime metadata for workflow runs.
Functions
-
registerModuleTaskHandlers(
TaskRegistry registry, Iterable< TaskHandler< handlers) → voidObject?> > - Registers task handlers while tolerating re-registration of identical handler instances.
-
task<
T extends Object?> (String name, {Map< String, Object?> args = const {}, Map<String, String> headers = const {}, TaskOptions options = const TaskOptions(), Map<String, Object?> meta = const {}, DateTime? notBefore, T decode(Object? payload)?}) → TaskSignature<T> - Returns a TaskSignature that creates an Envelope for a task.
Typedefs
-
TaskArgsDecoder<
TArgs> = TArgs Function(Map< String, Object?> args) - Decodes persisted task arguments into the typed handler input.
-
TaskEntrypoint
= FutureOr<
Object?> Function(TaskInvocationContext context, Map<String, Object?> args) - Signature for task entrypoints that can run inside isolate executors.
-
TaskMetaBuilder<
TArgs> = Map< String, Object?> Function(TArgs args) - Builds metadata for a task invocation using its arguments.
-
TaskResultDecoder<
TResult> = TResult Function(Object? payload) - Decodes a persisted task result payload into a typed value.
-
WorkflowScriptBody<
T extends Object?> = FutureOr< T> Function(WorkflowScriptContext context) - Declarative workflow definition built via FlowBuilder.
Exceptions / Errors
- ScheduleConflictException
- Thrown when a schedule mutation conflicts with a newer store version.
- SignatureVerificationException
- Thrown when an envelope signature is missing or invalid.
- TaskCancellationException
- Thrown when a task cooperatively observes cancellation.
- TaskRetryRequest
- Signals an explicit retry request from within a task handler.
- TaskRevokedException
- Exception thrown when a task is revoked during execution.
- WorkflowSuspensionSignal
- Internal control-flow signal used by expression-style suspension helpers.