OmegaWorkflowFlow class abstract

Optional advanced flow: models a process as explicit steps.

This keeps Omega's core model intact (events/intents/channel) and adds:

  • step registration
  • controlled transitions
  • standard step/error expressions for UI/Inspector
Inheritance

Constructors

OmegaWorkflowFlow({required String id, required OmegaEventBus channel})

Properties

channel OmegaEventBus
Event bus (channel or OmegaChannelNamespace); the flow listens to channel.events and can emit events.
finalinherited
contract OmegaFlowContract?
Optional declarative contract: events listened, intents accepted, expression types emitted. When set, in debug mode Omega warns if the flow receives or emits something not declared. Override in subclasses to declare contracts. Default is null (no validation). Cached on first access so prefer returning a const or stable instance.
no setterinherited
currentStepId String?
Current workflow step id (if started).
no setter
expressions Stream<OmegaFlowExpression>
Stream the UI listens to for updates (loading, success, error, etc.).
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
Flow identifier (e.g. "authFlow"). Must match the one used in the manager.
finalinherited
memory Map<String, dynamic>
Flow memory (key/value). Persists while the flow is active; can be restored with restoreMemory.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state OmegaFlowState
Current state. onEvent and onIntent are only called when OmegaFlowState.running.
getter/setter pairinherited

Methods

completeWorkflow({dynamic payload}) → void
Emits a standard workflow completion expression.
defineStep(String id, OmegaWorkflowStepHandler handler) → void
Registers a step handler.
emitExpression(String type, {dynamic payload}) → void
Notifies the UI of a state change (loading, success, error). The UI listens to expressions.
inherited
end() → void
Ends the flow and closes its streams. Unsubscribes from the channel so no further events are delivered.
inherited
failStep(String code, {String? message}) → void
Emits a standard workflow error expression.
getSnapshot() OmegaFlowSnapshot
Snapshot of current state (id, state, memory, last expression). For debugging, persistence or restore.
inherited
next(String stepId) Future<void>
Moves workflow to the next step and executes it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEnd() → void
inherited
onEvent(OmegaFlowContext ctx) → void
Implement the reaction to channel events (e.g. "auth.login.success"). Only called when the flow is running.
inherited
onIntent(OmegaFlowContext ctx) → void
Implement the reaction to intents (e.g. login, logout). Only called when the flow is running.
inherited
onPause() → void
inherited
onSleep() → void
inherited
onStart() → void
inherited
onWakeUp() → void
inherited
pause() → void
Pauses the flow temporarily.
inherited
receiveIntent(OmegaIntent intent) → void
Sends the intent to this flow. Only processed if state is running; then onIntent is called.
inherited
restoreMemory(Map<String, dynamic> data) → void
Replaces memory with data. Use after loading a snapshot (restore on launch).
inherited
sleep() → void
Puts the flow in "sleep" mode, reducing activity but keeping state.
inherited
start() → void
Puts the flow in OmegaFlowState.running and calls onStart. Invoked by the manager (activate/switchTo).
inherited
startAt(String stepId) Future<void>
Starts workflow execution at stepId.
toString() String
A string representation of this object.
inherited
wakeUp() → void
Wakes up a flow that was in sleep mode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited