firstWhereOrNull method
Returns the first element for which the return value of test
is true
.
Null is returned if either Null itself or there is no element for which the return value of test
is true
.
test
の返り値がtrue
になる場合の最初の要素を返します。
Implementation
T? firstWhereOrNull(bool Function(T item) test) {
if (this == null || isEmpty) {
return null;
}
for (final element in this!) {
if (test(element)) {
return element;
}
}
return null;
}