where<T extends V> method

Map<K, T> where<T extends V>(
  1. bool callback(
    1. V element
    )
)

Implementation

Map<K, T> where<T extends V> (bool Function(V element) callback) {
  Map<K, T> result = {};
  forEach((key, value) {
    if (callback(value)) {
      result.putIfAbsent(key, () => value as T);
    }
  });

  return result;
}