expandNode method

void expandNode(
  1. TreeNode<D> node
)

Implementation

void expandNode(TreeNode<D> node) {
  if (node == null) {
    _nodeToExpand.clear();
  } else if (node.hasChildren) {
    // Collapse rings up to the clicked expanded node.
    if (node.children.any((e) => _nodeToExpand.contains(e))) {
      node.visit((e) {
        if (node != e) {
          _nodeToExpand.remove(e);
        }
      });
    } else {
      // Expand clicked node by one level.
      _nodeToExpand.add(node);
      _nodeToExpand.addAll(node.children);
    }
  }
}