toArrayWithDefault static method

List toArrayWithDefault(
  1. dynamic value,
  2. List defaultValue
)

Converts value into array object with specified default. Single values are converted into arrays with single element.

  • value the value to convert.
  • defaultValue default array object. Returns array object or default array when value is null.

See toNullableArray

Implementation

static List toArrayWithDefault(value, List defaultValue) {
  var result = ArrayConverter.toNullableArray(value);
  return result ?? defaultValue;
}