cFirstWhere method
Get the first item from the iterable that satisfies a condition.
If the iterable is empty or no element satisfies the condition, this method returns null.
Parameters:
test
: A function that takes an element of the iterable and returnstrue
if the element satisfies the condition.
Implementation
T? cFirstWhere(bool Function(T element) test) {
final list = where(test);
return list.isEmpty ? null : list.first;
}