count method

int count(
  1. bool predicate(
    1. T
    )?
)

Returns the number of elements matching the given predicate.

Implementation

int count(bool Function(T)? predicate) =>
    predicate == null ? size : where(predicate).length;