setSelectionStateForMultiSelectionMode method

void setSelectionStateForMultiSelectionMode(
  1. bool newSelectionState,
  2. bool deselectParentWhenChildrenDeselected
)

Changes the selection state for this item and all of its children to either all selected or all deselected. Also appropriately updates the selection state of this item's parents as required. This should not be used for an item that belongs to a TreeView in single selection mode. See also TreeView.deselectParentWhenChildrenDeselected.

Implementation

void setSelectionStateForMultiSelectionMode(
    bool newSelectionState, bool deselectParentWhenChildrenDeselected) {
  selected = newSelectionState;
  children.executeForAll((item) {
    item.selected = newSelectionState;
  });
  executeForAllParents(
      (p) => p?.updateSelected(deselectParentWhenChildrenDeselected));
}