indexOrNull method

int? indexOrNull(
  1. bool test(
    1. T? element
    )
)

The first index in the list that satisfies the provided test or null.

Implementation

int? indexOrNull(bool Function(T? element) test) {
  final index = indexWhere(test);

  if (index == -1) {
    return null;
  }

  return index;
}