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

int compareTo(DateTime other) => _value.compareTo(other._value);