indexOfFirst method

Int indexOfFirst(
  1. bool predicate(
    1. T?
    )
)

Returns index of the first element matching the given predicate, or -1 if the array does not contain such element.

Implementation

Int indexOfFirst(bool Function(T?) predicate) {
  final value = find(predicate);
  if (value == null) return -1;
  return indexOf(value);
}