copyWith method
Copies a DateTime, overriding specified values.
A UTC DateTime will remain in UTC; a local DateTime will remain local.
Implementation
DateTime copyWith({
int? year,
int? month,
int? day,
int? hour,
int? minute,
int? second,
int? millisecond,
int? microsecond,
}) {
return (isUtc ? DateTime.utc : DateTime.new)(
year ?? this.year,
month ?? this.month,
day ?? this.day,
hour ?? this.hour,
minute ?? this.minute,
second ?? this.second,
millisecond ?? this.millisecond,
microsecond ?? this.microsecond,
);
}