NodeGraph<T> class

Immutable data class for graph serialization/deserialization All state management is handled by NodeFlowController

Constructors

NodeGraph({List<Node<T>> nodes = const [], List<Connection> connections = const [], List<Annotation> annotations = const [], GraphViewport viewport = const GraphViewport(), Map<String, dynamic> metadata = const {}})
const
NodeGraph.fromJson(Map<String, dynamic> json, T fromJsonT(Object? json))
factory

Properties

annotations List<Annotation>
final
connections List<Connection>
final
hashCode int
The hash code for this object.
no setterinherited
metadata Map<String, dynamic>
final
nodes List<Node<T>>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
viewport GraphViewport
final

Methods

areNodesConnected(String sourceNodeId, String targetNodeId) bool
Checks if two nodes are connected
getAnnotationById(String annotationId) Annotation?
Get an annotation by its ID
getAnnotationsForNode(String nodeId) List<Annotation>
Get annotations that depend on a specific node
getAnnotationsOfType<A extends Annotation>() List<A>
Get annotations of a specific type
getBounds() Rect
Gets the bounding box of all nodes
getGroupAnnotations() List<GroupAnnotation>
Get all group annotations
getInputConnections(String nodeId) List<Connection>
Gets all input connections for a node
getLeafNodes() List<Node<T>>
Gets nodes that have no output connections (leaf nodes)
getMarkerAnnotations() List<MarkerAnnotation>
Get all marker annotations
getNodeById(String nodeId) Node<T>?
Get a node by its ID
getNodeConnections(String nodeId) List<Connection>
Gets all connections for a specific node
getNodeIndex(String nodeId) int
Get the index of a node by its ID
getOutputConnections(String nodeId) List<Connection>
Gets all output connections for a node
getPortConnections(String nodeId, String portId) List<Connection>
Gets connections for a specific port
getRootNodes() List<Node<T>>
Gets nodes that have no input connections (root nodes)
getStickyAnnotations() List<StickyAnnotation>
Get all sticky annotations
hasCircularDependency() bool
Validates the graph for circular dependencies
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(Object? toJsonT(T value)) Map<String, dynamic>
toJsonString({bool indent = false}) String
Convenience method to convert graph to JSON string
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromAsset<T>(String assetPath, T fromJsonT(Object? json)) Future<NodeGraph<T>>
Convenience method to load graph from asset file
fromAssetMap(String assetPath) Future<NodeGraph<Map<String, dynamic>>>
Convenience method to load graph with Map data from asset file
fromJsonMap(Map<String, dynamic> json) NodeGraph<Map<String, dynamic>>
Simple factory for Map data type (most common case)
fromJsonString<T>(String jsonString, T fromJsonT(Object? json)) NodeGraph<T>
Convenience method to load graph from JSON string
fromJsonStringMap(String jsonString) NodeGraph<Map<String, dynamic>>
Convenience method to load graph with Map data from JSON string
fromUrl(String url) Future<NodeGraph<Map<String, dynamic>>>