generateDayList method

List<DateTime> generateDayList(
  1. int days, {
  2. bool startOfDay = true,
})

Generates a list of DateTime objects for consecutive days.

Starts from this and generates days number of dates.

Implementation

List<DateTime> generateDayList(int days, {bool startOfDay = true}) {
  final List<DateTime> dayList = <DateTime>[];
  DateTime currentDate = this;
  for (int i = 0; i < days; i++) {
    dayList.add(currentDate);
    currentDate = currentDate.nextDay(startOfDay: startOfDay);
  }
  return dayList;
}