FlNodeEditorController class

A controller class for the Node Editor.

This class is responsible for managing the state of the node editor, including the nodes, links, and the viewport. It also provides methods for adding, removing, and manipulating nodes and links.

The controller also provides an event bus for the node editor, allowing different parts of the application to communicate with each other by sending and receiving events.

Constructors

FlNodeEditorController({FlNodeEditorConfig config = const FlNodeEditorConfig(), FlNodeEditorStyle style = const FlNodeEditorStyle(), Future<bool> projectSaver(Map<String, dynamic> jsonData)?, Future<Map<String, dynamic>?> projectLoader(bool isSaved)?, Future<bool> projectCreator(bool isSaved)?})

Properties

clipboard ↔ FlNodeEditorClipboard
latefinal
config ↔ FlNodeEditorConfig
///////////////////////////////////////////////////////////////////////////// Node editor configuration and style. ///////////////////////////////////////////////////////////////////////////////
getter/setter pair
eventBus → NodeEditorEventBus
///////////////////////////////////////////////////////////////////////////// Controller subsystems are used to manage the state of the node editor. ///////////////////////////////////////////////////////////////////////////// The event bus is used to communicate between different susbsystems and with the UI.
final
hashCode int
The hash code for this object.
no setterinherited
history ↔ FlNodeEditorHistory
latefinal
linksById Map<String, Link>
no setter
linksDataDirty bool
getter/setter pair
lodLevel int
///////////////////////////////////////////////////////////////////////////// Rendering accellerators are data stored in the controller to speed up rendering. /////////////////////////////////////////////////////////////////////////////
getter/setter pair
nodePrototypes Map<String, NodePrototype>
///////////////////////////////////////////////////////////////////// Nodes and links management. /////////////////////////////////////////////////////////////////////
final
nodePrototypesAsList List<NodePrototype>
no setter
nodes Map<String, NodeInstance>
final
nodesAsList List<NodeInstance>
no setter
nodesDataDirty bool
getter/setter pair
project ↔ FlNodeEditorProject
latefinal
runner ↔ FlNodeEditorRunner
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedLinkIds Set<String>
final
selectedNodeIds Set<String>
///////////////////////////////////////////////////////////////////////// Selection management. ////////////////////////////////////////////////////////////////////////
final
selectionArea Rect
getter/setter pair
spatialHashGrid → SpatialHashGrid
final
style FlNodeEditorStyle
final
no setter
viewportOffset Offset
no setter
viewportZoom double
no setter

Methods

This method is used to add a link between two ports.
addLinkFromExisting(Link link, {String? eventId, bool isHandled = false}) → void
This method is used to add a link from an existing link object.
addNode(String name, {Offset offset = Offset.zero}) NodeInstance
This method is used to add a NodeInstance to the node editor by its prototype name.
addNodeFromExisting(NodeInstance node, {bool isHandled = false, String? eventId}) → void
This method is used to add a node from an existing node object.
This method is used to break all links associated with a port.
clear() → void
This method is used to clear the core controller and all of its subsystems.
clearSelection({bool isHandled = false}) → void
This method is used to deselect all selected nodes.
This method is used to clear the temporary link from the node editor.
dispose() → void
This method is used to dispose of the node editor controller and all of its resources, subsystems and members.
dragSelection(Offset delta, {String? eventId, bool isWorldDelta = false, bool resetUnboundOffset = false}) → void
This method is used to drag the selected nodes by a given delta affecting their offsets.
This method is used to draw a temporary link between two points in the node editor.
enableAutoPlacement(bool enable) → void
Enable or disable auto placement of nodes in the node editor.
enableSnapToGrid(bool enable) → void
Quick access to frequently used configuration properties. Enable or disable zooming in the node editor.
focusNodesById(Set<String> ids) → void
////////////////////////////////////////////////////////////////// Miscellaneous helpers useful for node editors. ////////////////////////////////////////////////////////////////// This method is used to focus the viweport on a set of nodes by their IDs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerNodePrototype(NodePrototype prototype) → void
This method is used to register a node prototype with the node editor.
removeLinkById(String id, {String? eventId, bool isHandled = false}) → void
This method is used to remove a link by its ID.
removeNodeById(String id, {String? eventId, bool isHandled = false}) → void
This method is used to remove a node by its ID.
searchNodesByName(String name) Future<List<String>>
This method is used to find all nodes with the specified display name.
selectLinkById(String id, {bool holdSelection = false, bool isHandled = false}) → void
This method is used to select a link by its ID.
selectNodesByArea({bool holdSelection = false}) → void
This method is used to select nodes that are contained within the selection area.
selectNodesById(Set<String> ids, {bool holdSelection = false, bool isHandled = false}) → void
This method is used to select nodes by their IDs.
setConfig(FlNodeEditorConfig config) → void
Set the global configuration of the node editor.
setFieldData(String nodeId, String fieldId, {dynamic data, required FieldEventType eventType}) → void
This method is used to set the data of a field in a node.
setSelectionArea(Rect area) → void
This method is used to set the selection area for selecting nodes.
setSnapToGridSize(double size) → void
Set the size of the grid to snap to in the node editor.
setViewportOffset(Offset offset, {bool animate = true, bool absolute = false, bool isHandled = false}) → void
This method is used to set the offset of the viewport.
setViewportZoom(double zoom, {bool animate = true, bool isHandled = false}) → void
This method is used to set the zoom level of the viewport.
toggleCollapseSelectedNodes(bool collapse) → void
This method is used to toggle the collapse state of all selected nodes.
toString() String
A string representation of this object.
inherited
unregisterNodePrototype(String name) → void
This method is used to remove a node prototype by its name.
updateViewportOffsetFromUI(Offset offset) → void
updateViewportZoomFromUI(double zoom) → void
The update...FromUI methods are helpers used to update the viewport properties from the UI defaulting event parameters to the correct values.

Operators

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