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 a 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 are inclusive. Unselectable dates within the selected range are selected regardless.
Contract
Throws AssertionError if:
- the given dates in
initialSelectionare not in UTC timezone andtruncateAndStripTimezoneis 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);