collapseAllOtherSiblingNodes method

Future<void> collapseAllOtherSiblingNodes(
  1. ITreeNode<Data> node
)

Implementation

Future<void> collapseAllOtherSiblingNodes(ITreeNode<Data> node) async {
  await Future.wait(
    (node.parent?.childrenAsList ?? []).map((siblingNode) {
      if (siblingNode.key != node.key &&
          (siblingNode as ITreeNode).isExpanded) {
        return collapseNode(siblingNode as ITreeNode<Data>);
      }
      return Future.value();
    }),
  );
}