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