isFirstDayOfWeek method
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
bool isFirstDayOfWeek(DateTime day, {int firstWeekday = DateTime.monday}) {
assert(firstWeekday > 0 && firstWeekday < 8);
return isSameDay(firstDayOfWeek(day, firstWeekday: firstWeekday), day);
}