invertSelection method

void invertSelection(
  1. List<T> items
)

Inverts the current selection.

Implementation

void invertSelection(List<T> items) {
  if (selectionMode != SelectionMode.multiple) {
    return;
  }

  final selected = controller.selectedItems.toSet();

  final inverted = items.where((item) => !selected.contains(item)).toList();

  controller.setSelection(inverted);
}