stringifyExtraProperties static method
HashMap<String, String>
stringifyExtraProperties(
- HashMap<
String, TBLExtraPropertyWithLevel> pageExtraProperties
Converts extra properties with levels to JSON-encoded strings. Properties that fail to encode are skipped and logged.
Implementation
static HashMap<String, String> stringifyExtraProperties(
HashMap<String, TBLExtraPropertyWithLevel> pageExtraProperties) {
return HashMap.fromEntries(
pageExtraProperties.entries.map((entry) {
try {
final key = entry.key;
final value = entry.value;
final jsonString = jsonEncode(value.toJson());
return MapEntry(key, jsonString);
} catch (e) {
// Log error and skip this property by returning null
TBLLogger.logException(
"TBLPropertiesUtils | stringifyExtraProperties | Error encoding property ${entry.key}: $e");
return null;
}
}).whereType<MapEntry<String, String>>(),
);
}