getDaysInBetween static method

List<DateTime> getDaysInBetween(
  1. DateTime startDate,
  2. DateTime endDate
)

Returns the dates of startDate and endDate.

Implementation

static List<DateTime> getDaysInBetween(DateTime startDate, DateTime endDate) {
  if (endDate.isBefore(startDate)) {
    endDate = startDate;
  }

  List<DateTime> days = [];
  for (int i = 0; i <= endDate.difference(startDate).inDays; i++) {
    days.add(startDate.add(Duration(days: i)));
  }

  return days;
}