retrieveWeekendDates static method

List<int> retrieveWeekendDates({
  1. required DateTime inMonth,
})

This method returns a list of int values representing the days of the specified inMonth that are in the weekend.

Implementation

static List<int> retrieveWeekendDates({required DateTime inMonth}) {
  var daysInMonth = retrieveDaysInMonth(inMonth);
  var listOfDates = List<int>.generate(daysInMonth, (i) => i + 1);
  var filterDates = listOfDates
      .where((element) =>
          DateTime(inMonth.year, inMonth.month, element).isWeekend)
      .toList();
  return filterDates;
}