isSortedByKey<K extends Comparable<K>> method

bool isSortedByKey<K extends Comparable<K>>(
  1. K key(
    1. T
    )
)

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

Implementation

bool isSortedByKey<K extends Comparable<K>>(K Function(T) key) {
  for (int i = _start; i < _end - 1; i++) {
    if (key(_list[i]).compareTo(key(_list[i + 1])) > 0) {
      return false;
    }
  }
  return true;
}