addInput method

  1. @override
Node<T>? addInput(
  1. T nodeValue
)
override

Add a node to the inputs if it has not been added yet.

  • Resolves nodeValue to a Node using graph.
  • Returns true if it was added without duplication.
  • Throws a StateError if graph is null when trying to resolve nodeValue to a Node.

Implementation

@override
Node<T>? addInput(T nodeValue) {
  if (nodeValue == value) return null;

  if (!containsInput(nodeValue)) {
    var node = _resolveNode(nodeValue);
    return _addInputNode(node);
  }

  return null;
}