years property

Iterable<Timespan> get years

get all years that overlap with a the Timespan

Implementation

Iterable<Timespan> get years sync* {
  DateTime i = begin.beginOfYear();
  int counter = 0;
  do {
    yield Timespan(
        begin: DateTime(i.year + counter),
        end: DateTime(i.year + counter + 1).subtract(const Duration(hours: 1)));
    counter++;
  } while (DateTime(begin.year + counter).isBefore(end));
}