firstWhereOrNull method

T? firstWhereOrNull(
  1. bool test(
    1. T
    )
)

Returns the first element that satisfies the given predicate test, or null if there are none.

Implementation

T? firstWhereOrNull(bool Function(T) test) {
  try {
    return this.firstWhere(test);
  } catch (_) {
    return null;
  }
}