deserializeMetadata method
Deserialized Metadata, which encapsulates common types.
Custom metadata needs to be converted by covert
.
Implementation
Map<String, dynamic> deserializeMetadata(Map<String, dynamic>? metadata,
{dynamic Function(String key, dynamic value)? covert,
List<NamedAttribution>? customNameAttribution}) {
return metadata?.map((key, value) {
var covertValue = covert?.call(key, value);
if (covertValue != null) {
return MapEntry(key, covertValue);
}
if (key == "singleColumnLayout" && value != null) {
return MapEntry(key, deserializeSingleColumnLayoutMetadata(value));
}
final nameAttrs = [
...?customNameAttribution,
..._allNameAttribution,
];
for (var nameAttr in nameAttrs) {
if (nameAttr.id == value) {
return MapEntry(key, NamedAttribution(value));
}
}
return MapEntry(key, value);
}) ??
{};
}