toMapWithDefault static method

Map<String, dynamic> toMapWithDefault(
  1. dynamic value,
  2. Map<String, dynamic> defaultValue
)

Converts value into map object or returns default when conversion is not possible

  • value the value to convert.
  • defaultValue the default value. Returns map object or emptu map when conversion is not supported.

See toNullableMap

Implementation

static Map<String, dynamic> toMapWithDefault(
    value, Map<String, dynamic> defaultValue) {
  var result = MapConverter.toNullableMap(value);
  return result ?? defaultValue;
}