getDaysForRange method

List<DateTime> getDaysForRange(
  1. DateTime endDate
)

获取时间区间内所有的日期

Implementation

List<DateTime> getDaysForRange(DateTime endDate) {
  List<DateTime> result = [];
  DateTime date = this;
  while (date.difference(endDate).inDays <= 0) {
    result.add(date);
    date = date.add(const Duration(hours: 24));
  }
  return result;
}