generateWithDayStep static method

Iterable<DateTime> generateWithDayStep(
  1. DateTime start,
  2. DateTime end
)

Returns an iterable of DateTime with 1 day step in given range.

start is the start of the range, inclusive. end is the end of the range, exclusive.

If start equals end, than start still will be included in iterable. If start less than end, than empty iterable will be returned.

DateTime in result uses start timezone.

Implementation

static Iterable<DateTime> generateWithDayStep(
    DateTime start, DateTime end) sync* {
  if (end.isBefore(start)) return;

  var date = start;
  do {
    yield date;
    date = nextDay(date);
  } while (date.isBefore(end));
}