deselect method

void deselect(
  1. DateTime date
)

Removes date from the selection. No-op when detached, when date isn't selected, or in range mode (use clearSelection or selectRange). Does not scroll and fires no callbacks.

Implementation

void deselect(DateTime date) {
  final state = _datePickerState;
  if (state == null) return;
  if (state.widget.selectionMode == SelectionMode.range) return;
  final key = state._unitKey(date);
  if (!state._selection.contains(key)) return;
  final next = List<DateTime>.of(state._selection)..remove(key);
  state._applyProgrammaticSelection(next, anchor: key);
}