ProductCardItem.fromJson constructor

ProductCardItem.fromJson(
  1. Json j
)

Parses the wire shape.

Implementation

factory ProductCardItem.fromJson(Json j) => ProductCardItem(
  id: strOr(j, 'id'),
  name: strOr(j, 'name'),
  price: numOf(j, 'price') ?? 0,
  compareAtPrice: numOf(j, 'compare_at_price'),
  currency: strOr(j, 'currency', 'VND'),
  imageUrl: str(j, 'image_url'),
  url: str(j, 'url'),
  sku: str(j, 'sku'),
  appStoreProductId: str(mapOf(j, 'store_product_ids') ?? const {}, 'app_store'),
  googlePlayProductId: str(mapOf(j, 'store_product_ids') ?? const {}, 'google_play'),
  basePlanId: str(j, 'base_plan_id'),
  offerId: str(j, 'offer_id'),
  billingPeriod: str(j, 'billing_period'),
  trialDays: numOf(j, 'trial_days')?.toInt(),
);