firstWhereOrNull method
Tries to find the first element in the list that matches the given test
.
Returns null if no such element is found.
Implementation
T? firstWhereOrNull(bool Function(T) test) {
for (T element in this) {
if (test(element)) {
return element;
}
}
return null;
}