countTrue property

int get countTrue

Counts the number of true values in the iterable.

This getter iterates through each element in the iterable and increments a counter each time it encounters a true value. The final count is returned.

Returns:

  • The number of true values in the iterable.

Implementation

int get countTrue => where((bool e) => e).length;