findIndex method

int findIndex(
  1. bool condition(
    1. T
    )
)

Implementation

int findIndex(bool Function(T) condition) {
  for (var i = 0; i < length; i++) {
    if (condition(this[i])) {
      return i;
    }
  }
  return -1; // Return -1 if no match found
}