getAsMapWithDefault method

AnyValueMap getAsMapWithDefault(
  1. String key,
  2. AnyValueMap defaultValue
)

Converts map element into an AnyValueMap or returns default value if conversion is not possible.

  • key a key of element to get.
  • defaultValue the default value Returns AnyValueMap value of the element or default value if conversion is not supported.

See getAsNullableMap

Implementation

AnyValueMap getAsMapWithDefault(String key, AnyValueMap defaultValue) {
  var result = getAsNullableMap(key);
  return result ?? defaultValue;
}