firstOrNullWhere method
Returns the first element matching the given predicate
, or null
if no
such element was found.
var list = ['a', 'Test'];
var firstLong= list.firstOrNullWhere((e) => e.length > 1); // 'Test'
var firstVeryLong = list.firstOrNullWhere((e) => e.length > 5); // null
Implementation
E? firstOrNullWhere(bool Function(E element) predicate) {
return firstWhereOrNull(predicate);
}