Modules
Install workflows and handlers through WorkflowModule. Do not load graph definitions into an engine cache, and do not call registerWorkflow after startup.
dart
final runtime = WorkflowRuntime(
storage: storage,
modules: [
WorkflowModule(
name: 'orders',
workflows: [orderApproval, Workflow.fromJson(jsonDocument)],
activities: [
ActivityBinding.from(reserve, ReservationHandler()),
],
userTasks: [approve],
signals: [paymentReceived],
),
],
);WorkflowServerApplication takes the same list. A product package exports one module.
JSON Definitions
Workflow.fromJson 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);