getAsArrayWithDefault method

AnyValueArray getAsArrayWithDefault(
  1. int index,
  2. AnyValueArray defaultValue
)

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

  • index an index of element to get.
  • defaultValue the default value Returns AnyValueArray value of the element or default value if conversion is not supported.

See getAsNullableArray

Implementation

AnyValueArray getAsArrayWithDefault(int index, AnyValueArray defaultValue) {
  var result = getAsNullableArray(index);
  return result ?? defaultValue;
}