addWhenNotNull static method
Adds a key-value pair to a JSON map if the value is not null. If the value is null, no key-value pair is added.
Implementation
static void addWhenNotNull(
Map<String, dynamic> json, String key, dynamic value) {
if (value == null) return;
json[key] = value;
}