toggleSelectItems<K> static method

List<TreeNode<K>> toggleSelectItems<K>(
  1. List<TreeNode<K>> nodes,
  2. Iterable<K> targets
)

Implementation

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