Events
An event is a typed fact sent into a workflow run. The workflow waits; a product API sends the payload with a deduplication key.
dart
final receipt = await flow.waitForEvent(
paymentReceived,
id: 'payment',
);Events sent before the workflow waits are buffered. Duplicate deliveries with the same idempotency key do not append a second history event.
JSON documents use an event step and an inputBinding for the expected payload shape.
When to Use an Event vs Work
| Use | Why |
|---|---|
| Work | An actor is asked to do something and must respond |
| Event | A system, webhook, or another execution path reports a fact |
Do not hide automated execution inside a work response handler. Start the external job in an operation, then wait for an event.