setVisibleRowsSelected method

void setVisibleRowsSelected(
  1. bool selected
)

Selects or clears all currently visible selectable rows.

Implementation

void setVisibleRowsSelected(bool selected) {
  if (rowSelectionMode != TreeDataTableRowSelectionMode.multiple) {
    return;
  }

  final next = Set<Object>.of(selectedRowIdsNotifier.value);
  for (final row in flattenedVisibleRows()) {
    if (!isRowSelectable(row)) {
      continue;
    }
    final id = row.sourceNode!.id!;
    if (selected) {
      next.add(id);
    } else {
      next.remove(id);
    }
  }
  _applyUserSelection(next);
}