clean function

Map<String, dynamic> clean(
  1. Map<String, dynamic> obj
)

Remove null / empty-string / empty-map entries (shallow). Mirrors the JS clean() so mapping + parity stay byte-for-byte equivalent to the TS source.

Implementation

Map<String, dynamic> clean(Map<String, dynamic> obj) {
  final out = <String, dynamic>{};
  obj.forEach((k, v) {
    if (v == null || v == '') return;
    if (v is Map && v.isEmpty) return;
    out[k] = v;
  });
  return out;
}