removeNullEntries<T> static method
T?
removeNullEntries<T>(
- T? json
Implementation
static T? removeNullEntries<T>(T? json) {
if (json == null) return null;
if (json is List) {
json.removeWhere((dynamic e) => e == null);
json.forEach(removeNullEntries);
} else if (json is Map) {
json.removeWhere((dynamic key, dynamic value) => key == null || value == null);
json.values.forEach(removeNullEntries);
}
return json;
}