count method

int count(
  1. bool test(
    1. K key,
    2. V value
    )
)

Returns the number of entries that satisfy test.

Implementation

int count(bool Function(K key, V value) test) {
  var count = 0;

  for (final MapEntry(:key, :value) in entries) {
    if (!test(key, value)) continue;
    count++;
  }

  return count;
}