copyWith method

  1. @useResult
LocalDate copyWith({
  1. int? year,
  2. int? month,
  3. int? day,
})

Returns a copy of this with the updated units of time.

LocalDate(2023, 4, 15).copyWith(day: 20); // 2023-04-20

Implementation

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