setSelection method

void setSelection(
  1. List<Seat> newSelection
)

Replaces the entire selection with newSelection.

Implementation

void setSelection(List<Seat> newSelection) {
  _selectedSeatsMap.clear();
  for (final seat in newSelection) {
    if (maxSelectedSeats != null &&
        _selectedSeatsMap.length >= maxSelectedSeats!) {
      break;
    }
    _selectedSeatsMap[seat.id] = seat.copyWith(status: SeatStatus.selected);
  }
  notifyListeners();
  onSelectionChanged?.call(selectedSeats);
}