toRange method

  1. @override
RangeCalendarValue toRange()
override

Implementation

@override
RangeCalendarValue toRange() {
  assert(dates.isNotEmpty, 'Cannot convert empty list to range');
  DateTime min = dates
      .reduce((value, element) => value.isBefore(element) ? value : element);
  DateTime max = dates
      .reduce((value, element) => value.isAfter(element) ? value : element);
  return CalendarValue.range(min, max);
}