range static method
Creates a FCalendarController that allows a single range to be selected, with the given initial range.
selectable
will always return true if not given.
truncateAndStripTimezone
determines whether the controller should truncate and convert all given DateTimes to
dates in UTC timezone. Defaults to true.
DateTime truncateAndStripTimezone(DateTime date) => DateTime.utc(date.year, date.month, date.day);
truncateAndStripTimezone
should be set to false if you can guarantee that all dates are in UTC timezone (with
the help of an 3rd party library), which will improve performance. Warning: Giving a DateTime in local
timezone or with a time component when truncateAndStripTimezone
is false is undefined behavior.
Both the start and end dates of the range is inclusive. Unselectable dates within the selected range are selected regardless.
Contract
Throws AssertionError if:
- the given dates in
initialSelection
is not in UTC timezone andtruncateAndStripTimezone
is false. - the end date is less than start date.
Implementation
static FCalendarController<(DateTime, DateTime)?> range({
(DateTime, DateTime)? initialSelection,
Predicate<DateTime>? selectable,
bool truncateAndStripTimezone = true,
}) =>
truncateAndStripTimezone
? _AutoRangeController(initialSelection: initialSelection, selectable: selectable)
: _RangeController(initialSelection: initialSelection, selectable: selectable);