DateRangeEditorModel constructor

DateRangeEditorModel({
  1. DatepickerComparison? initialValue,
  2. Date? minDate,
  3. Date? maxDate,
  4. bool requireFullPeriods = false,
  5. bool basic = false,
  6. List<ComparisonOption> supportedComparisonOptions = const [],
})

Implementation

DateRangeEditorModel(
    {DatepickerComparison? initialValue,
    Date? minDate,
    Date? maxDate,
    this.requireFullPeriods = false,
    this.basic = false,
    List<ComparisonOption> supportedComparisonOptions = const []})
    : _ref = ObservableReference(initialValue) {
  this.supportedComparisonOptions = (supportedComparisonOptions.isNotEmpty)
      ? supportedComparisonOptions
      : defaultComparisonOptions;
  this.minDate = minDate ?? Date.today();
  this.maxDate = maxDate ?? Date.today();

  _updateHasNextPrev(initialValue);
  _updateValidComparisonOptions();
  _disposer
    ..addFunction(_changes.close)
    ..addStreamSubscription(_ref.stream.listen(_setEverything))
    ..addStreamSubscription(range.stream.listen(_setPrimaryRange))
    ..addStreamSubscription(comparison.stream.listen(_setComparisonRange))
    ..addStreamSubscription(calendar.changes.listen(_onCalendarChange));
}