daysThrough method
Returns every calendar day from this date through end, inclusive.
Days are built from calendar fields rather than a fixed 24-hour Duration, so each one stays at midnight across daylight saving changes.
Example:
final days = DateTime(2026, 2, 24).daysThrough(DateTime(2026, 2, 26));
// returns: [Feb 24, Feb 25, Feb 26]
Implementation
List<DateTime> daysThrough(DateTime end) {
final count = DateTime.utc(
end.year,
end.month,
end.day,
).difference(DateTime.utc(year, month, day)).inDays;
return [
for (var i = 0; i <= count; i++) DateTime(year, month, day + i),
];
}