containsKey method

bool containsKey(
  1. dynamic key
)
inherited

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.

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

Implementation

bool containsKey(dynamic key) {
    if (key is! String && key is! int) {
        throw Exception('must pass either a String or an int for a Record field lookup');
    }
    return key is String ? super.containsKey(candid_text_hash(key)) : super.containsKey(key);
}