firstWhereNullable method

T? firstWhereNullable(
  1. bool test(
    1. T
    ), {
  2. T orElse()?,
})

Implementation

T? firstWhereNullable(bool Function(T) test, {T Function()? orElse}) {
  try {
    return firstWhere(test);
  } on StateError {
    return null;
  }
}