addOutput method

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

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

  • Resolves nodeValue to a Node using graph.
  • Returns the Node 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>? addOutput(T nodeValue) {
  if (nodeValue == value) return null;

  if (!containsOutput(nodeValue)) {
    var node = _resolveNode(nodeValue);
    return _addOutputNode(node);
  }

  return null;
}