compareTo method
- Timestamp other
override
Compares this Timestamp to another.
Parameters:
other: The other Timestamp.
Returns: Negative if less, positive if greater, zero if equal.
Example:
if (ts1.compareTo(ts2) < 0) print('ts1 is earlier');
Implementation
@override
int compareTo(Timestamp other) {
if (seconds == other.seconds) {
return nanoseconds.compareTo(other.nanoseconds);
}
return seconds.compareTo(other.seconds);
}