expand method

void expand(
  1. K key
)

Implementation

void expand(K key) {
  final ancestors = getAncestorsOfKey(key);
  final LinkedHashSet<K> newExpandedKeys;

  if (expansionMode == TExpansionMode.single) {
    // Avoid direct LinkedHashSet<K>() instantiation inside the extension on web (DDC),
    // which can yield a LinkedSet<dynamic> at runtime. Using the class helper
    // copyKeySet preserves the reified type parameter K.
    newExpandedKeys = copyKeySet(ancestors)..add(key);
  } else {
    newExpandedKeys = copyKeySet(expandedKeys)
      ..addAll(ancestors)
      ..add(key);
  }

  updateExpansionState(newExpandedKeys);
}