firstWhereOrNull method

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

Returns the first value in the list if it is success null otherwise

Implementation

T? firstWhereOrNull(bool Function(T) predicate) {
  final iterable = whereOrNull(predicate);

  if (iterable != null && iterable.isNotEmpty) {
    return iterable.first;
  }

  return null;
}