sortRange method Null safety

void sortRange (
  1. int start,
  2. int end,
  3. [int compare(
    1. E a,
    2. E b
    )]
)

Sort a range of elements by compare.

If compare is omitted, the range is sorted according to the natural ordering of the elements.

Implementation

void sortRange(int start, int end, [int Function(E a, E b)? compare]) {
  RangeError.checkValidRange(start, end, length);
  algorithms.quickSortBy<E, E>(
      this, identity, compare ?? compareComparable, start, end);
}