toMapWithDefault static method

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

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

  • value the JSON string to convert.
  • defaultValue the default value. Returns Map object value or default when conversion is not supported.

See toNullableMap

Implementation

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