PortWidgetBuilder<T> typedef

PortWidgetBuilder<T> = Widget Function(BuildContext context, Node<T> node, Port port)

Builder function for creating a port widget.

This is used for per-instance port customization. The builder receives the node containing this port, allowing access to typed node data.

Type Parameters

  • T: The type of data stored in the containing node

Parameters

  • context: The build context for widget creation
  • node: The node containing this port (use node.data for typed access)
  • port: The port being rendered

Example

final port = Port(
  id: 'input-1',
  name: 'Data',
  widgetBuilder: (context, node, port) {
    final myNode = node as Node<MyData>;
    return Container(
      width: 12,
      height: 12,
      decoration: BoxDecoration(
        color: myNode.data?.isActive == true ? Colors.green : Colors.blue,
        shape: BoxShape.circle,
      ),
    );
  },
);

Implementation

typedef PortWidgetBuilder<T> =
    Widget Function(BuildContext context, Node<T> node, Port port);