updateExtraProperties static method

bool updateExtraProperties(
  1. HashMap<String, String> incomingProperties,
  2. Map<String, TBLExtraPropertyWithLevel> targetExtraProperties,
  3. TBLExtraPropertyLevel incomingPropertiesLevel
)

Updates extra properties at the specified level, filtering empty keys/values.

incomingProperties The properties to update targetExtraProperties The target map to update (global, page, or unit properties) incomingPropertiesLevel The level to tag incoming properties with

Returns true if any properties changed (requires notification to observers).

Implementation

static bool updateExtraProperties(HashMap<String, String> incomingProperties,
    Map<String, TBLExtraPropertyWithLevel> targetExtraProperties, TBLExtraPropertyLevel incomingPropertiesLevel) {
  bool shouldNotifyUnits = false;

  incomingProperties.forEach((key, value) {
    if (!TextUtils.isEmptyOrNull(key) && !TextUtils.isEmptyOrNull(value)) {
      TBLExtraPropertyWithLevel propertyWithLevel = TBLExtraPropertyWithLevel(
        value: value,
        level: incomingPropertiesLevel,
      );

      if (shouldUpdateLocalExtraProperty(key, propertyWithLevel, targetExtraProperties)) {
        targetExtraProperties[key] = propertyWithLevel;
        shouldNotifyUnits = true;
      }
    }
  });

  return shouldNotifyUnits;
}