expandOrCollapse method

TreeNode expandOrCollapse(
  1. int index
)

Click item to expand or contract or collapse index The index of the clicked item

Implementation

TreeNode expandOrCollapse(int index) {
  var treeNode = treeNodeOfIndex(index);
  if (treeNode.expanded) {
    collapseItem(treeNode);
  } else {
    expandItem(treeNode);
  }

  ///notify refresh ListTreeView
  notifyListeners();
  return treeNode;
}