lastDayOfWeek property

  1. @useResult
DateTime get lastDayOfWeek

The last day of the week.

final tuesday = DateTime(2023, 4, 11);
final sunday = tuesday.lastDayOfWeek; // 2023-04-16

Implementation

@useResult DateTime get lastDayOfWeek => copyWith(day: day + 7 - weekday, hour: 0, minute: 0, second: 0, millisecond: 0, microsecond: 0);