isSortedBy method

bool isSortedBy(
  1. Comparator<T> compare
)

Checks if the elements of this slice are sorted using the given comparator function.

Implementation

bool isSortedBy(Comparator<T> compare) {
  for (var i = _start; i < _end - 1; i++) {
    if (compare(_list[i], _list[i + 1]) > 0) {
      return false;
    }
  }
  return true;
}