getAsMapWithDefault method

AnyValueMap getAsMapWithDefault(
  1. int index,
  2. AnyValueMap defaultValue
)

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

  • index an index 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(int index, AnyValueMap defaultValue) {
  var result = getAsNullableMap(index);
  return result != null ? AnyValueMap.fromValue(result) : defaultValue;
}