collapseItem<K> static method
Implementation
static List<TreeNode<K>> collapseItem<K>(List<TreeNode<K>> nodes, K target) {
return replaceNodes(nodes, (node) {
if (node is TreeItem<K> && node.data == target && node.expanded) {
return node.updateState(expanded: false);
}
return null;
});
}