yearsBetween function

List<int> yearsBetween(
  1. DateTime start,
  2. DateTime end
)

List of years from start.year through end.year (inclusive).

Implementation

List<int> yearsBetween(DateTime start, DateTime end) {
  final List<int> out = <int>[];
  for (int y = start.year; y <= end.year; y++) {
    out.add(y);
  }
  return out;
}