copyWith method

PersianDate copyWith({
  1. int? year,
  2. int? month,
  3. int? day,
})

Returns a date-only copy with the given fields replaced.

The result is validated like PersianDate.new and throws ArgumentError instead of clamping, so copyWith(day: 31) on a 30-day month throws. The time of day is dropped.

Implementation

PersianDate copyWith({int? year, int? month, int? day}) =>
    PersianDate(year ?? this.year, month ?? this.month, day ?? this.day);