compareTo method

int compareTo(
  1. Duration other
)
override

Compares this Duration to other.

Returns a negative integer if this Duration's offset is smaller than that of other, a positive integer if this duration's offset is greater than that of other, and 0 if they are equivalent.

A longer positive duration ends after a shorter positive duration, a positive duration ends after a negative duration, and a shorter negative duration ends after a longer negative duration. Equivalent to comparing the inMicroseconds of the duration).

It is always the case that duration1.compareTo(duration2) < 0 if and only if (someDate + duration1).compareTo(someDate + duration2) < 0.

Implementation

int compareTo(Duration other) =>
    inMicroseconds.compareTo(other.inMicroseconds);