IaphubProduct.fromJson constructor

IaphubProduct.fromJson(
  1. Map<String, dynamic> json
)

Constructor from JSON

Implementation

IaphubProduct.fromJson(Map<String, dynamic> json)
    : id = json["id"] ?? "",
      type = json["type"] ?? "",
      sku = json["sku"] ?? "",
      price = json["price"] != null
          ? double.parse(json["price"].toString())
          : 0.0,
      currency = json["currency"],
      localizedPrice = json["localizedPrice"],
      localizedTitle = json["localizedTitle"],
      localizedDescription = json["localizedDescription"],
      group = json["group"],
      groupName = json["groupName"],
      subscriptionDuration = json["subscriptionDuration"],
      subscriptionIntroPhases = json["subscriptionIntroPhases"]
          ?.map<IaphubSubscriptionIntroPhase>(
              (data) => IaphubSubscriptionIntroPhase.fromJson(data))
          ?.toList(),
      metadata = (json["metadata"] as Map?)?.map(
          (key, value) => MapEntry(key.toString(), value.toString()),
      ) ?? {};