Duration constructor Null safety

const Duration(
  1. {int days: 0,
  2. int hours: 0,
  3. int minutes: 0,
  4. int seconds: 0,
  5. int milliseconds: 0,
  6. int microseconds: 0}
)

Creates a new Duration object whose value is the sum of all individual parts.

Individual parts can be larger than the next-bigger unit. For example, hours can be greater than 23.

All individual parts are allowed to be negative. All arguments are 0 by default.

Implementation

const Duration(
    {int days = 0,
    int hours = 0,
    int minutes = 0,
    int seconds = 0,
    int milliseconds = 0,
    int microseconds = 0})
    : this._microseconds(microsecondsPerDay * days +
          microsecondsPerHour * hours +
          microsecondsPerMinute * minutes +
          microsecondsPerSecond * seconds +
          microsecondsPerMillisecond * milliseconds +
          microseconds);