plus method

  1. @useResult
Period plus({
  1. int years = 0,
  2. int months = 0,
  3. int days = 0,
  4. int hours = 0,
  5. int minutes = 0,
  6. int seconds = 0,
  7. int milliseconds = 0,
  8. int microseconds = 0,
})

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

No normalization is performed.

Period(years: 1, months: 1).plus(months: 12); // 1 year 13 months

Implementation

@useResult Period plus({
  int years = 0,
  int months = 0,
  int days = 0,
  int hours = 0,
  int minutes = 0,
  int seconds = 0,
  int milliseconds = 0,
  int microseconds = 0,
}) => copyWith(
  years: this.years + years,
  months: this.months + months,
  days: this.days + days,
  hours: this.hours + hours,
  minutes: this.minutes + minutes,
  seconds: this.seconds + seconds,
  milliseconds: this.milliseconds + milliseconds,
  microseconds: this.microseconds + microseconds,
);