putObjectIfNotEmpty method
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);
}