shouldUpdateLocalExtraProperty static method
bool
shouldUpdateLocalExtraProperty(
- String incomingPropertyKey,
- TBLExtraPropertyWithLevel incomingExtraProperty,
- Map<
String, TBLExtraPropertyWithLevel> targetExtraProperties
Determines if a local extra property should be updated.
Returns true if:
- Property doesn't exist → always update
- Incoming is page-level → can override anything (if value differs)
- Incoming is global-level → can only override global, NOT page
Note: Unit-level properties only exist in unitExtraProperties, not in page/global maps. This ensures that page-level properties are not overridden by global updates.
Implementation
static bool shouldUpdateLocalExtraProperty(
String incomingPropertyKey,
TBLExtraPropertyWithLevel incomingExtraProperty,
Map<String, TBLExtraPropertyWithLevel> targetExtraProperties) {
final targetExtraPropertyWithIncomingKey = targetExtraProperties[incomingPropertyKey];
// If property doesn't exist, always update
if (targetExtraPropertyWithIncomingKey == null) {
return true;
}
// If incoming is page-level, it can override anything (if value differs)
if (incomingExtraProperty.level == TBLExtraPropertyLevel.page) {
return _isPropertyValueDifferentThanExisting(
targetExtraPropertyWithIncomingKey.value, incomingExtraProperty.value);
}
// Incoming is global-level
// Global cannot override page-level properties (page has higher priority)
if (targetExtraPropertyWithIncomingKey.level == TBLExtraPropertyLevel.page) {
return false; // Reject the global update
}
// Both existing and incoming are global-level - update if value differs
return _isPropertyValueDifferentThanExisting(
targetExtraPropertyWithIncomingKey.value, incomingExtraProperty.value);
}