duration property

Duration? get duration

Returns a Duration representation of this Iso8601Duration.

Importantly, this returns null if the Iso8601Duration has the years and/or the months fields set to a value other than zero.

Implementation

Duration? get duration {
  if (years != 0 && months != 0) {
    return null;
  }

  return Duration(
    seconds: seconds,
    minutes: minutes,
    hours: hours,
    days: days,
  );
}