set method

JsonMap<D> set(
  1. String key,
  2. D value, [
  3. D onConflict(
    1. D old,
    2. D value
    )?
])

Implementation

JsonMap<D> set(String key, D value,
    [D Function(D old, D value)? onConflict]) {
  if (containsKey(key)) {
    this[key] = onConflict?.call(this[key] as D, value) ?? value;
  } else {
    putIfAbsent(key, () => value);
  }
  return this;
}