isKeyInMap static method

void isKeyInMap(
  1. dynamic key,
  2. Map map, [
  3. String message = DEFAULT_KEY_IN_MAP_MESSAGE
])

Validate that the specified key is in the map and if so the value is not null. If %key% is found in [message] it will be replaced with [key].toString()

key the key to validate, map to validate, must not be null Throws ArgumentError if the key is not found in the map or if the value found is null.

Implementation

static void isKeyInMap(final dynamic key, final Map map,
    [String message = DEFAULT_KEY_IN_MAP_MESSAGE]) {
  DartValidate.notNull(map, message);
  if (!map.containsKey(key) || map[key] == null) {
    throw new ArgumentError(message
        .replaceFirst("%key%", key.toString())
        .replaceFirst("%structure%", _PRETTYJSON.convert(map)));
  }
}