dates static method

FCalendarController<Set<DateTime>> dates({
  1. Set<DateTime> initialSelections = const {},
  2. Predicate<DateTime>? selectable,
  3. bool truncateAndStripTimezone = true,
})

Creates a FCalendarController that allows multiple dates to be selected, with the given initial selected dates.

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.

Contract

Throws AssertionError if the dates in initialSelections are not in UTC timezone and truncateAndStripTimezone is false.

Implementation

static FCalendarController<Set<DateTime>> dates({
  Set<DateTime> initialSelections = const {},
  Predicate<DateTime>? selectable,
  bool truncateAndStripTimezone = true,
}) =>
    truncateAndStripTimezone
        ? _AutoDatesController(initialSelections: initialSelections, selectable: selectable)
        : _DatesController(initialSelections: initialSelections, selectable: selectable);