compareTo method Null safety

  1. @override
  2. @nonVirtual
int compareTo(
  1. FocusOrder other
)
nonVirtual">@nonVirtualoverride

Compares this object to another Comparable.

When overriding FocusOrder, implement doCompare instead of this function to do the actual comparison.

Returns a value like a Comparator when comparing this to other. That is, it returns a negative integer if this is ordered before other, a positive integer if this is ordered after other, and zero if this and other are ordered together.

The other argument must be a value that is comparable to this object.

Implementation

@override
@nonVirtual
int compareTo(FocusOrder other) {
  assert(
    runtimeType == other.runtimeType,
    "The sorting algorithm must not compare incomparable keys, since they don't "
    'know how to order themselves relative to each other. Comparing $this with $other',
  );
  return doCompare(other);
}