serializeMetadata method
Serializing metadata, which encapsulates generic data transformations.
Custom metadata needs to be converted via the covert
callback method.
Implementation
Map<String, dynamic> serializeMetadata(Map<String, dynamic>? metadata,
{dynamic Function(String key, dynamic value)? covert}) {
return metadata?.map((key, value) {
var covertValue = covert?.call(key, value);
if (covertValue != null) {
return MapEntry(key, covertValue);
}
if (value is Attribution) {}
if (value is NamedAttribution) {
return MapEntry(key, value.id);
}
if (key == "singleColumnLayout" && value != null) {
return MapEntry(key, serializeSingleColumnLayoutMetadata(value));
}
return MapEntry(key, value?.toString());
}) ??
{};
}