copyWith method
Returns a copy of this with the updated units of time.
final foo = ZonedDateTime('Asia/Singapore', 2023, 4, 15);
foo.copyWith(day: 20); // 2023-04-20T00:00+08:00[Asia/Singapore]
Implementation
@useResult ZonedDateTime copyWith({Timezone? timezone, int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) =>
ZonedDateTime.from(
timezone ?? this.timezone,
year ?? this.year,
month ?? this.month,
day ?? this.day,
hour ?? this.hour,
minute ?? this.minute,
second ?? this.second,
millisecond ?? this.millisecond,
microsecond ?? this.microsecond,
);