putJSONableIfNotEmpty method
Maps name
to jsonable
after converting it to a Map, clobbering any existing
name/value mapping with the same name. If the Map argument is empty, any existing mapping
for name
is removed.
Implementation
void putJSONableIfNotEmpty(String name, JSONable? jsonable) {
Map<String, dynamic>? json = jsonable?.toJson();
if (json == null || json.isEmpty) {
this?.remove(name);
return;
}
put(name, json);
}