toggle method

void toggle({
  1. required TKey key,
  2. bool animate = true,
})

Toggles the expansion state of the given node.

Implementation

void toggle({required TKey key, bool animate = true}) {
  if (_isExpandedKey(key)) {
    collapse(key: key, animate: animate);
  } else {
    expand(key: key, animate: animate);
  }
}