notif_updateMapIfNotSameOrEmptyOrNull method

void notif_updateMapIfNotSameOrEmptyOrNull({
  1. required Map data,
  2. required List<String> ignoreKeys,
})

Implementation

void notif_updateMapIfNotSameOrEmptyOrNull({
  required Map data,
  required List<String> ignoreKeys,
}) {
  data.forEach((key, value) {
    if (ignoreKeys.contains(key)) {
      return;
    }
    try {
      // jika tidak ada key
      if (!containsKey(key)) {
        this[key] = value;
        return;
      }

      // jika ada value
      if (this[key] == null) {
        this[key] = value;
      } else if (value is Map && this[key] is Map) {
        (this[key] as Map).notif_updateMapIfNotSameOrEmptyOrNull(data: value, ignoreKeys: ignoreKeys);
      } else if (key is List && this[key] is List) {}
    } catch (e) {}
  });
  notif_removeKeyRecursive(ignoreKeys: ignoreKeys);
  return;
}