W3cubDocs

/Dart 2

compareTo method

int compareTo (Duration other)

Compares this Duration to other, returning zero if the values are equal.

Returns a negative integer if this Duration is shorter than other, or a positive integer if it is longer.

A negative Duration is always considered shorter than a positive one.

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

Implementation

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

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/Duration/compareTo.html