Skip to content

Child Workflows ​

Child workflows are independently durable runs. The runtime supports call, spawn, and join.

dart
final receipt = await flow.workflow(
  publishOrderWorkflow,
  order,
  id: 'publish-order',
);

final handle = await flow.spawn(
  notifyWorkflow,
  order,
  id: 'notify',
);
final notifyResult = await flow.join(handle, id: 'wait-notify');

call starts a child and waits. spawn returns a WorkflowHandle. join waits later. JSON uses call, spawn, and join steps; spawn publishes a handle map that join consumes.

A spawned run has its own history, commands, and digest. Cancellation of the parent reaches attached spawned runs. A spawn reconciler creates the child once and completes the parent command after the child reaches a terminal state.

Compiled documents resolve the child workflow's stable code:vN key inside the document compiler; Dart handlers pass the child WorkflowHandler to workflow(...).

See Also ​