months method

Iterable<DateTime> months()

Generates an iterable of DateTime objects representing each month within the date range.

Implementation

Iterable<DateTime> months() sync* {
  var i = startDate;
  while (i.isBefore(endDate)) {
    yield i;
    if (i.month == 12) {
      i = DateTime(i.year + 1, 1, i.day);
    } else {
      i = DateTime(i.year, i.month + 1, i.day);
    }
  }
}