Comparable<T> abstract class
Interface used by types that have an intrinsic ordering.
abstract class Comparable<T> {
/**
* Compares this object to another [Comparable]
*
* Returns a value like a [Comparator] when comparing [:this:] to [other].
*
* May throw an [ArgumentError] if [other] is of a type that
* is not comparable to [:this:].
*/
int compareTo(T other);
/**
* Compare one comparable to another.
*
* This utility function is used as the default comparator
* for the [List] sort function.
*/
static int compare(Comparable a, Comparable b) => a.compareTo(b);
}
Subclasses
DateTime, Duration, Entry, Level, Location, Span, String, intx, num
Static Methods
int compare(Comparable a, Comparable b) #
Compare one comparable to another.
This utility function is used as the default comparator for the List sort function.
static int compare(Comparable a, Comparable b) => a.compareTo(b);
Methods
abstract int compareTo(T other) #
Compares this object to another Comparable
Returns a value like a Comparator when comparing this to
other.
May throw an ArgumentError if
other is of a type that
is not comparable to this.