putObjectIfNotEmpty method

void putObjectIfNotEmpty(
  1. String name,
  2. Map<String, dynamic>? jsonObject
)

Maps name to jsonObject, clobbering any existing name/value mapping with the same name. If the Map is empty, any existing mapping for name is removed.

Implementation

void putObjectIfNotEmpty(String name, Map<String, dynamic>? jsonObject) {
  if (jsonObject == null || jsonObject.isEmpty) {
    this?.remove(name);
    return;
  }
  put(name, jsonObject);
}