expandNode<K> static method

List<TreeNode<K>> expandNode<K>(
  1. List<TreeNode<K>> nodes,
  2. TreeNode<K> target
)

Expands a specific node.

Parameters:

  • nodes (List<TreeNode<K>>, required): Tree nodes.
  • target (TreeNode<K>, required): Node to expand.

Returns: List<TreeNode<K>> — tree with node expanded.

Implementation

static List<TreeNode<K>> expandNode<K>(
    List<TreeNode<K>> nodes, TreeNode<K> target) {
  return replaceNodes(nodes, (node) {
    return node == target ? node.updateState(expanded: true) : null;
  });
}