firstWhereOrNull method
Returns the first element that satisfies the predicate or null
if none match.
Parameters
test
: The predicate to check
Returns
- The first element that satisfies the predicate or
null
if none match
Implementation
T? firstWhereOrNull(ConditionTester<T> test) {
for (var element in this) {
if (test(element)) return element;
}
return null;
}