isLastDayOfWeek method
Checks if day is in the last 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, so the last day will be DateTime.sunday.
Implementation
bool isLastDayOfWeek(DateTime day, {int firstWeekday = DateTime.monday}) {
assert(firstWeekday > 0 && firstWeekday < 8);
return isSameDay(lastDayOfWeek(day, firstWeekday: firstWeekday), day);
}