asAny method

dynamic asAny(
  1. String key, {
  2. required dynamic def,
})

Retrieves the value associated with the key. If the key does not exist, returns the def value.

key The key in the map to retrieve the value from. def The default value to return if the key is not found. This must be specified.

Returns: The value associated with the key or def if not found.

Implementation

dynamic asAny(String key, {required dynamic def}) {
  if (keys.contains(key)) {
    return this[key];
  }

  return def;
}