NodeGraph<T> class
Immutable data class for graph serialization/deserialization All state management is handled by NodeFlowController
Constructors
-
NodeGraph({List<
Node< nodes = const [], List<T> >Connection> connections = const [], GraphViewport viewport = const GraphViewport(), Map<String, dynamic> metadata = const {}}) -
const
-
NodeGraph.fromJson(Map<
String, dynamic> json, T fromJsonT(Object? json), {Node<T> nodeFromJson(Map<String, dynamic> json, T fromJsonT(Object? json))?}) -
factory
Properties
-
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
-
getBounds(
) → Rect - Gets the bounding box of all nodes
-
getCommentNodes(
) → List< CommentNode< T> > - Get all comment nodes
-
getGroupNodes(
) → List< GroupNode< T> > - Get all group nodes
-
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)
-
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
-
getRegularNodes(
) → List< Node< T> > - Get regular nodes (excluding GroupNode and CommentNode)
-
getRootNodes(
) → List< Node< T> > - Gets nodes that have no input connections (root nodes)
-
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), {Node< T> nodeFromJson(Map<String, dynamic> json, T fromJsonT(Object? json))?}) → Future<NodeGraph< T> > - Convenience method to load graph from asset file
-
fromAssetMap(
String assetPath, {Node< Map< nodeFromJson(Map<String, dynamic> >String, dynamic> json, Map<String, dynamic> fromJsonT(Object? json))?}) → Future<NodeGraph< Map< >String, dynamic> > - Convenience method to load graph with Map data from asset file
-
fromJsonMap(
Map< String, dynamic> json, {Node<Map< nodeFromJson(Map<String, dynamic> >String, dynamic> json, Map<String, dynamic> fromJsonT(Object? json))?}) → NodeGraph<Map< String, dynamic> > - Simple factory for Map data type (most common case)
-
fromJsonString<
T> (String jsonString, T fromJsonT(Object? json), {Node< T> nodeFromJson(Map<String, dynamic> json, T fromJsonT(Object? json))?}) → NodeGraph<T> - Convenience method to load graph from JSON string
-
fromJsonStringMap(
String jsonString, {Node< Map< nodeFromJson(Map<String, dynamic> >String, dynamic> json, Map<String, dynamic> fromJsonT(Object? json))?}) → NodeGraph<Map< String, dynamic> > - Convenience method to load graph with Map data from JSON string
-
fromUrl(
String url, {Node< Map< nodeFromJson(Map<String, dynamic> >String, dynamic> json, Map<String, dynamic> fromJsonT(Object? json))?}) → Future<NodeGraph< Map< >String, dynamic> >