containsKey method
Whether this map contains the given key
.
Returns true if any of the keys in the map are equal to key
according to the equality used by the map.
このマップに指定された key
が含まれているかどうかを調べます。
マップ内のキーのいずれかが、マップで使用される等式に従ってkey
と等しい場合に true を返します。
final moonCount = <String, int>{'Mercury': 0, 'Venus': 0, 'Earth': 1,
'Mars': 2, 'Jupiter': 79, 'Saturn': 82, 'Uranus': 27, 'Neptune': 14 };
final containsUranus = moonCount.containsKey('Uranus'); // true
final containsPluto = moonCount.containsKey('Pluto'); // false
Returns false
if itself is Null.
自身がNullな場合はfalse
を返します。
Implementation
bool containsKey(Object? key) {
if (this == null) {
return false;
}
return this!.containsKey(key);
}