setSelection method

CalendarState setSelection(
  1. CalendarSelection val, {
  2. CausedBy cause = CausedBy.external,
  3. bool previewAnchoredAtStart = false,
})

Updates the value for the given selection. Creates it if it's not in the list of selections already.

Implementation

CalendarState setSelection(CalendarSelection val,
    {CausedBy cause = CausedBy.external,
    bool previewAnchoredAtStart = false}) {
  var newSelections = [val]..addAll(selections.where((s) => s.id != val.id));
  return CalendarState(
      selections: newSelections,
      currentSelection: currentSelection,
      cause: cause,
      previewAnchoredAtStart: previewAnchoredAtStart,
      resolution: resolution);
}