find method

T? find(
  1. bool test(
    1. T element
    )
)

Returns either the first element of the list which satisfies the provided test or null if there is none.

Implementation

T? find(bool Function(T element) test) {
  final index = indexWhere((element) => test(element));

  return index != -1 ? this[index] : null;
}