toggleSelectItem<K> static method

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

Implementation

static List<TreeNode<K>> toggleSelectItem<K>(
    List<TreeNode<K>> nodes, K target) {
  return replaceNodes(nodes, (node) {
    if (node is TreeItem<K> && node.data == target) {
      return node.updateState(selected: !node.selected);
    }
    return null;
  });
}