copyWith method

RecurrenceRule copyWith({
  1. Frequency? frequency,
  2. DateTime? until,
  3. bool clearUntil = false,
  4. int? count,
  5. bool clearCount = false,
  6. int? interval,
  7. bool clearInterval = false,
  8. List<int>? bySeconds,
  9. List<int>? byMinutes,
  10. List<int>? byHours,
  11. List<ByWeekDayEntry>? byWeekDays,
  12. List<int>? byMonthDays,
  13. List<int>? byYearDays,
  14. List<int>? byWeeks,
  15. List<int>? byMonths,
  16. List<int>? bySetPositions,
})

Implementation

RecurrenceRule copyWith({
  Frequency? frequency,
  DateTime? until,
  bool clearUntil = false,
  int? count,
  bool clearCount = false,
  int? interval,
  bool clearInterval = false,
  List<int>? bySeconds,
  List<int>? byMinutes,
  List<int>? byHours,
  List<ByWeekDayEntry>? byWeekDays,
  List<int>? byMonthDays,
  List<int>? byYearDays,
  List<int>? byWeeks,
  List<int>? byMonths,
  List<int>? bySetPositions,
}) {
  assert(until.isValidRruleDateTime);
  assert(
    !(clearUntil && until != null),
    'A new value for `until` must not be specified when `clearUntil` is set.',
  );
  assert(
    !(clearCount && count != null),
    'A new value for `count` must not be specified when `clearCount` is set.',
  );
  assert(
    !(clearInterval && interval != null),
    'A new value for `interval` must not be specified when `clearInterval` '
    'is set.',
  );

  return RecurrenceRule(
    frequency: frequency ?? this.frequency,
    until: clearUntil ? null : until ?? this.until,
    count: clearCount ? null : count ?? this.count,
    interval: clearInterval ? null : interval ?? this.interval,
    bySeconds: bySeconds ?? this.bySeconds,
    byMinutes: byMinutes ?? this.byMinutes,
    byHours: byHours ?? this.byHours,
    byWeekDays: byWeekDays ?? this.byWeekDays,
    byMonthDays: byMonthDays ?? this.byMonthDays,
    byYearDays: byYearDays ?? this.byYearDays,
    byWeeks: byWeeks ?? this.byWeeks,
    byMonths: byMonths ?? this.byMonths,
    bySetPositions: bySetPositions ?? this.bySetPositions,
  );
}