copyWith method
DateMessage
copyWith({
- String? after,
- String? any,
- String? before,
- String betweenDates()?,
- String? every,
- String? refine,
- String? required,
- ArrayMessage? array,
- String? weekday,
- String? weekend,
override
Creates a copy of the current DateMessage
instance with updated values.
If a parameter is not provided, the existing value is retained.
Example
final defaultMessage = DateMessage();
final customMessage = defaultMessage.copyWith(after: 'Date should be later than expected');
print(customMessage.after); // Output: 'Date should be later than expected'
Implementation
@override
DateMessage copyWith({
String? after,
String? any,
String? before,
String Function(DateTime min, DateTime max)? betweenDates,
String? every,
String? refine,
String? required,
ArrayMessage? array,
String? weekday,
String? weekend,
}) {
return DateMessage(
after: after ?? this.after,
any: any ?? this.any,
array: array ?? this.array,
before: before ?? this.before,
betweenDates: betweenDates ?? this.betweenDates,
every: every ?? this.every,
refine: refine ?? this.refine,
required: required ?? this.required,
weekday: weekday ?? this.weekday,
weekend: weekend ?? this.weekend,
);
}