baseSortedIndex function

int baseSortedIndex(
  1. List list,
  2. dynamic value, [
  3. bool retHighest = false
])

The base implementation of sortedIndex

Implementation

int baseSortedIndex(List list, dynamic value, [bool retHighest = false]) {
  int low = 0;
  int high = list.length;
  while (low < high) {
    int mid = (low + high) >> 1;
    var computed = list[mid];
    if (computed != null &&
        (retHighest ? (computed <= value) : (computed < value))) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  return high;
}