WorkflowBuilder class final
Assembles a graph without repeating node identifiers.
The literal form is fine for a diagram-shaped workflow and tedious for a chain, where every edge restates two identifiers that are obvious from the order.
final graph = (WorkflowBuilder('triage')
..chain([startNode, classifyNode])
..branch('classify', {'urgent': escalateNode, 'routine': replyNode})
..chain([escalateNode, endNode])
..edge('reply', 'end'))
.build();
Constructors
- WorkflowBuilder(String id, {String? description, bool allowCycles = false})
-
Creates a builder for a graph called
id.
Properties
- allowCycles → bool
-
Whether cycles are intentional.
final
- description → String?
-
What the workflow does.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Identifier of the graph being built.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
WorkflowNode node) → void -
Adds
node. -
addAll(
Iterable< WorkflowNode> nodes) → void -
Adds every node in
nodes. -
branch(
String from, Map< String, WorkflowNode> targets) → void -
Adds labelled edges from
fromto each entry oftargets. -
build(
) → WorkflowGraph - Builds and validates the graph.
-
chain(
List< WorkflowNode> nodes) → void -
Adds
nodesand connects them in order. -
edge(
String from, String to, {String? label}) → void - Adds an edge.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startAt(
String nodeId) → void - Names the start node explicitly.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited