isFirstDayOfWeek static method

bool isFirstDayOfWeek(
  1. DateTime day,
  2. {int? firstWeekday}
)

Checks if day is in the first day of a week.

You can define first weekday (Monday, Sunday or Saturday) with parameter firstWeekday. It should be one of the constant values DateTime.monday, ..., DateTime.sunday.

By default it's DateTime.monday.

Implementation

static bool isFirstDayOfWeek(DateTime day, {int? firstWeekday}) {
  assert(firstWeekday == null || firstWeekday > 0 && firstWeekday < 8);

  return isSameDay(firstDayOfWeek(day, firstWeekday: firstWeekday), day);
}