count method

int count([
  1. bool test(
    1. E element
    )?
])

Returns the number of elements passing the given test. If test is not provided it returns the number of elements in the Iterable.

Implementation

int count([bool Function(E element)? test]) =>
    test == null ? length : where(test).length;