exportGraph method

NodeGraph<T> exportGraph()

Exports the current graph state including all nodes, connections, annotations, and viewport.

This creates a snapshot of the entire graph that can be serialized and saved. Use loadGraph to restore the graph from the exported data.

Returns a NodeGraph containing all current graph data.

Example:

// Export the graph
final graph = controller.exportGraph();

// Save to JSON
final json = graph.toJson();

Implementation

NodeGraph<T> exportGraph() {
  return NodeGraph<T>(
    nodes: _nodes.values.toList(),
    connections: _connections,
    annotations: annotations.sortedAnnotations,
    viewport: _viewport.value,
  );
}