dateRange function
Generates a range of dates from start to end inclusive, stepping by stepDays days.
Implementation
Iterable<DateTime> dateRange(DateTime start, DateTime end, {int stepDays = 1}) sync* {
if (stepDays <= 0) return;
final DateTime startDate = DateTime(start.year, start.month, start.day);
final DateTime endDate = DateTime(end.year, end.month, end.day);
DateTime current = startDate;
while (!current.isAfter(endDate)) {
yield current;
current = DateTime(current.year, current.month, current.day + stepDays);
}
}