int compareTo(
DateTime other
)

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

This function returns a negative integer if this DateTime is smaller (earlier) than other, or a positive integer if it is greater (later).

Source

/**
 * Compares this DateTime object to [other],
 * returning zero if the values are equal.
 *
 * This function returns a negative integer
 * if this DateTime is smaller (earlier) than [other],
 * or a positive integer if it is greater (later).
 */
int compareTo(DateTime other)
    => millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch);