NamiPaywall.fromMap constructor

NamiPaywall.fromMap(
  1. Map map
)

Implementation

factory NamiPaywall.fromMap(Map<dynamic, dynamic> map) {
  List<dynamic> dynamicSkus = map['namiSkus'];
  List<String> namiSkus = List.empty(growable: true);
  dynamicSkus.forEach((element) {
    namiSkus.add(element.toString());
  });

  dynamic styleDataMap = map['styleData'];
  PaywallStyleData? styleData;
  if (styleDataMap != null) {
    styleData = PaywallStyleData.fromMap(styleDataMap);
  }
  dynamic legalCitationsMap = map['legalCitations'];
  LegalCitations? legalCitation;
  if (legalCitationsMap != null) {
    legalCitation = LegalCitations.fromMap(legalCitationsMap);
  }
  dynamic displayOptionsMap = map['displayOptions'];
  PaywallDisplayOptions displayOptions =
      PaywallDisplayOptions.fromMap(displayOptionsMap);
  dynamic localeConfigMap = map['localeConfig'];
  NamiLocaleConfig localeConfig = NamiLocaleConfig.fromMap(localeConfigMap);
  return NamiPaywall(
      map['id'],
      map['developerPaywallId'],
      map['backgroundImageUrlPhone'],
      map['backgroundImageUrlTablet'],
      map['name'],
      map['title'],
      map['body'],
      legalCitation,
      displayOptions,
      map['purchaseTerms'],
      map['type'],
      map['extraData'],
      styleData,
      namiSkus,
      localeConfig);
}