Node<T> constructor

Node<T>({
  1. required String id,
  2. required String type,
  3. required Offset position,
  4. required T data,
  5. Size? size,
  6. List<Port> inputPorts = const [],
  7. List<Port> outputPorts = const [],
  8. int initialZIndex = 0,
})

Creates a new node with the specified properties.

Parameters:

  • id - Unique identifier for this node
  • type - Type classification for the node (e.g., 'input', 'processor', 'output')
  • position - Initial position in the graph coordinate space
  • data - Custom data associated with this node
  • size - Optional size, defaults to 150x100 if not specified
  • inputPorts - List of input ports for incoming connections
  • outputPorts - List of output ports for outgoing connections
  • initialZIndex - Initial stacking order, higher values appear on top

Implementation

Node({
  required this.id,
  required this.type,
  required Offset position,
  required this.data,
  Size? size,
  List<Port> inputPorts = const [],
  List<Port> outputPorts = const [],
  int initialZIndex = 0,
}) : size = Observable(size ?? const Size(150, 100)),
     position = Observable(position),
     visualPosition = Observable(position),
     // Initialize with same position
     zIndex = Observable(initialZIndex),
     selected = Observable(false),
     dragging = Observable(false),
     inputPorts = ObservableList.of(inputPorts),
     outputPorts = ObservableList.of(outputPorts);