valuesToNodes method

Iterable<Node<T>> valuesToNodes(
  1. Iterable<T> values, {
  2. bool createNodes = false,
})

Maps values to Nodes in this graph.

  • If createNodes is false will throw a StateError if the node is not present in this graph.

Implementation

Iterable<Node<T>> valuesToNodes(Iterable<T> values,
    {bool createNodes = false}) {
  if (createNodes) {
    return values.map((value) => node(value));
  } else {
    return values.map((value) =>
        getNode(value) ??
        (throw StateError("Can't find node with value: $value")));
  }
}