transformToPLYPresentation static method
Implementation
static PLYPresentation? transformToPLYPresentation(
Map<dynamic, dynamic> presentation) {
if (presentation.isEmpty) return null;
PLYPresentationType type = PLYPresentationType.normal;
try {
type = PLYPresentationType.values[presentation['type']];
} catch (e) {
print(e);
}
List<PLYPresentationPlan> plans = (presentation['plans'] as List)
.map((e) => PLYPresentationPlan(e['planVendorId'], e['storeProductId'],
e['basePlanId'], e['offerId']))
.toList();
Map<String, dynamic> metadata = {};
presentation['metadata']?.forEach((key, value) {
metadata[key] = value;
});
return PLYPresentation(
presentation['id'],
presentation['placementId'],
presentation['audienceId'],
presentation['abTestId'],
presentation['abTestVariantId'],
presentation['language'],
type,
plans,
metadata);
}