selectItems<K> static method

List<TreeNode<K>> selectItems<K>(
  1. List<TreeNode<K>> nodes,
  2. Iterable<K> selectedItems
)

Implementation

static List<TreeNode<K>> selectItems<K>(
    List<TreeNode<K>> nodes, Iterable<K> selectedItems) {
  return replaceNodes(nodes, (node) {
    if (node is TreeItem<K> && selectedItems.contains(node.data)) {
      return node.updateState(selected: true);
    }
    return null;
  });
}