where method

Map<K, V> where(
  1. bool test(
    1. K key,
    2. V value
    )
)

Extracts only elements for which the return value of the callback given by test is true.

An object different from the original object is returned.

testで与えたコールバックの戻り値がtrueの要素だけを抽出します。

元のオブジェクトとは別のオブジェクトが返されます。

Implementation

Map<K, V> where(bool Function(K key, V value) test) {
  return Map.from(this)..removeWhere((key, value) => !test(key, value));
}