getDateRange static method

List<HijriDate> getDateRange(
  1. HijriDate start,
  2. HijriDate end
)

Generates a list of dates between two dates

Implementation

static List<HijriDate> getDateRange(HijriDate start, HijriDate end) {
  if (!isValidDateRange(start, end)) {
    throw ArgumentError('Start date must be before or equal to end date');
  }

  final dates = <HijriDate>[];
  var current = start.copy();

  while (current <= end) {
    dates.add(current.copy());
    current = current.addDays(1);
  }

  return dates;
}