Skip to content

Modules ​

Install workflows and handlers through WorkflowModule. Registration is immutable after startup.

dart
final runtime = WorkflowRuntime(
  storage: storage,
  modules: [
    WorkflowModule(
      name: 'orders',
      workflows: [orderApproval, WorkflowDocument.compileJson(jsonDocument)],
      operations: [
        reserve.implement(reservationHandler),
      ],
      work: [approve],
      events: [paymentReceived],
    ),
  ],
);

WorkflowServerApplication takes the same list. A product package exports one module.

JSON Definitions ​

WorkflowDocument.compileJson validates and compiles the document before registration. Unknown fields, duplicate IDs, and dangling transitions fail at compile time, not at first replay.

Catalog ​

create_run never registers a workflow. It rejects an unknown, inactive, or digest-mismatched version. Seed workflow_versions in a reviewed migration and mark a version active only when it may accept new starts.

dart
await validateActiveWorkflowCatalog(registry: registry, catalog: storage);

See Also ​