compareTo method
Compares this
to other
.
Returns a negative number if this is less than other, zero if they are equal, and a positive number if this is greater than other.
Examples:
print(Commitment.finalized.compareTo(Commitment.processed)); // => 2
print(Commitment.finalized.compareTo(Commitment.confirmed)); // => 1
print(Commitment.finalized.compareTo(Commitment.finalized)); // => 0
print(Commitment.processed.compareTo(Commitment.processed)); // => 0
print(Commitment.processed.compareTo(Commitment.confirmed)); // => -1
print(Commitment.processed.compareTo(Commitment.finalized)); // => -2
Implementation
int compareTo(final Commitment? other) => index - (other?.index ?? -1);