startOfWeek property
DateTime
get
startOfWeek
Returns the start of the week (Monday).
Example:
DateTime(2024, 1, 15).startOfWeek; // Monday of that week
Implementation
DateTime get startOfWeek {
final weekday = this.weekday;
return subtract(Duration(days: weekday - 1)).startOfDay;
}