date static method
Creates a FCalendarController that allows only a single date to be selected, with the given initially selected date.
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.
Contract
Throws AssertionError if initialSelection
is not in UTC timezone and truncateAndStripTimezone
is false.
Implementation
static FCalendarController<DateTime?> date({
DateTime? initialSelection,
Predicate<DateTime>? selectable,
bool truncateAndStripTimezone = true,
}) =>
truncateAndStripTimezone
? _AutoDateController(initialSelection: initialSelection, selectable: selectable)
: _DateController(initialSelection: initialSelection, selectable: selectable);