enumerateDates function

Iterable<Date> enumerateDates(
  1. Date start,
  2. Date? end
)

Enumerates all dates from start to end, inclusive.

For example, if start is 2016-01-01 and end is 2016-01-02, then two elements, 2016-01-01, 2016-01-02, will be in the returned iterator.

Implementation

Iterable<Date> enumerateDates(Date start, Date? end) sync* {
  for (var date = start; date <= end; date = date.add(days: 1)) {
    yield date;
  }
}