firstWhereOrNull method
Returns the first element that satisfies the given predicate
, or null if none found.
Implementation
E? firstWhereOrNull(bool Function(E element) predicate) {
for (final element in this) {
if (predicate(element)) return element;
}
return null;
}