between static method

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

Implementation

static List<DateTime> between(DateTime start, DateTime end) {
  switch (start.compareTo(end)) {
    case 1:
      throw Error.throwWithStackTrace(
        "start can't be greator then end",
        StackTrace.current,
      );
    case 0:
      return [];
  }
  final days = <DateTime>[];
  for (int i = 0; i <= end.difference(start).inDays; i++) {
    days.add(start.add(Duration(days: i)));
  }
  return days;
}