linearSearch static method

int linearSearch(
  1. List<double> values,
  2. double target, [
  3. int step = 1
])

Implementation

static int linearSearch(List<double> values, double target, [int step = 1]) {
  for (int i = 0; i <= values.length - step; i += step) {
    if (values[i] > target) return i;
  }
  return -1;
}