countWhere method
Returns the number of elements that satisfy test.
Example:
[1, 2, 3, 4].countWhere((n) => n.isEven); // 2
Implementation
int countWhere(bool Function(E element) test) {
int count = 0;
for (final E element in this) {
if (test(element)) {
count++;
}
}
return count;
}