doCompare method Null safety

  1. @override
int doCompare(
  1. covariant OrdinalSortKey other
)
override

The implementation of compareTo.

The argument is guaranteed to be of the same type as this object and have the same name.

The method should return a negative number if this object comes earlier in the sort order than the argument; and a positive number if it comes later in the sort order. Returning zero causes the system to use default sort order.

Implementation

@override
int doCompare(OrdinalSortKey other) {
  if (other.order == null || order == null || other.order == order) {
    return 0;
  }
  return order.compareTo(other.order);
}