baseFindIndex function

dynamic baseFindIndex(
  1. List array,
  2. bool predicate(
    1. dynamic
    ),
  3. int fromIndex,
  4. bool fromRight,
)

Implementation

baseFindIndex(List<dynamic> array, bool Function(dynamic) predicate,
    int fromIndex, bool fromRight) {
  var length = array.length;
  var index = fromIndex + (fromRight ? 1 : -1);
  while (fromRight ? 0 < index-- : ++index < length) {
    if (predicate(array[index])) {
      return index;
    }
  }
  return -1;
}