listOfValidDatesInMonth static method

List<DateTime> listOfValidDatesInMonth(
  1. Month month,
  2. List<int> weekdaysToHide
)

Implementation

static List<DateTime> listOfValidDatesInMonth(
  Month month,
  List<int> weekdaysToHide,
) {
  final totalDays = month.daysInMonth;
  final validDates = <DateTime>[];
  for (int i = 1; i <= totalDays; i++) {
    final date = DateTime(month.year, month.month, i);
    if (!weekdaysToHide.contains(date.weekday)) {
      validDates.add(date);
    }
  }
  return (validDates);
}