XPathDuration constructor

const XPathDuration({
  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,
  9. int? totalMonths,
  10. int? totalMicroseconds,
  11. bool isNegative = false,
  12. XPathType type = xsDuration,
})

Creates a new XPathDuration.

Implementation

const new({
  int years = 0,
  int months = 0,
  int days = 0,
  int hours = 0,
  int minutes = 0,
  int seconds = 0,
  int milliseconds = 0,
  int microseconds = 0,
  int? totalMonths,
  int? totalMicroseconds,
  bool isNegative = false,
  this.type = xsDuration,
}) : totalMonths =
         totalMonths ?? (years * 12 + months) * (isNegative ? -1 : 1),
     totalMicroseconds =
         totalMicroseconds ??
         (days * Duration.microsecondsPerDay +
                 hours * Duration.microsecondsPerHour +
                 minutes * Duration.microsecondsPerMinute +
                 seconds * Duration.microsecondsPerSecond +
                 milliseconds * Duration.microsecondsPerMillisecond +
                 microseconds) *
             (isNegative ? -1 : 1);