copyWith method
Recurrence
copyWith({
- RecurrenceFrequency? frequency,
- DateTime? until,
- int? count,
- int? interval,
- List<
int> ? bySecond, - List<
int> ? byMinute, - List<
int> ? byHour, - List<
ByDayRule> ? byWeekDay, - List<
int> ? byYearDay, - List<
int> ? byWeek, - List<
int> ? byMonth, - List<
int> ? byMonthDay, - int? startOfWorkWeek,
- List<
int> ? bySetPos, - bool copyByRules = true,
- bool copyUntil = true,
Copies this recurrence rule with the given attributes.
Set copyByRules
to false
to not copy any by-rules.
This defaults to true
, meaning by rules are copied by default.
Set copyUntil
to false
to not copy the until attribute.
This defaults to true
, meaning the until attribute is copied by default.
Implementation
Recurrence copyWith({
RecurrenceFrequency? frequency,
DateTime? until,
int? count,
int? interval,
List<int>? bySecond,
List<int>? byMinute,
List<int>? byHour,
List<ByDayRule>? byWeekDay,
List<int>? byYearDay,
List<int>? byWeek,
List<int>? byMonth,
List<int>? byMonthDay,
int? startOfWorkWeek,
List<int>? bySetPos,
bool copyByRules = true,
bool copyUntil = true,
}) {
if (!copyByRules) {
return Recurrence(
frequency ?? this.frequency,
until: until ?? (copyUntil ? this.until : null),
count: count ?? this.count,
interval: interval ?? _interval,
startOfWorkWeek: startOfWorkWeek ?? _startOfWorkWeek,
bySecond: bySecond,
byMinute: byMinute,
byHour: byHour,
byWeekDay: byWeekDay,
byMonthDay: byMonthDay,
byYearDay: byYearDay,
byWeek: byWeek,
byMonth: byMonth,
bySetPos: bySetPos,
);
}
return Recurrence(
frequency ?? this.frequency,
until: until ?? (copyUntil ? this.until : null),
count: count ?? this.count,
interval: interval ?? _interval,
startOfWorkWeek: startOfWorkWeek ?? _startOfWorkWeek,
bySecond: bySecond ?? this.bySecond,
byMinute: byMinute ?? this.byMinute,
byHour: byHour ?? this.byHour,
byWeekDay: byWeekDay ?? this.byWeekDay,
byMonthDay: byMonthDay ?? this.byMonthDay,
byYearDay: byYearDay ?? this.byYearDay,
byWeek: byWeek ?? this.byWeek,
byMonth: byMonth ?? this.byMonth,
bySetPos: bySetPos ?? this.bySetPos,
);
}