ShopifyProduct.fromJson constructor

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

Implementation

ShopifyProduct.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  uId = json['uid'];
  title = json['title'];
  description = json['description'];
  createdAt = json['createdAt'];
  featuredImage = json['featuredImage'] != null
      ? FeaturedImage.fromJson(json['featuredImage'])
      : null;
  handle = json['handle'];
  publishedAt = json['publishedAt'];
  totalInventory = json['totalInventory'];
  priceRange = json['priceRange'] != null
      ? PriceRange.fromJson(json['priceRange'])
      : null;
  compareAtPriceRange = json['compareAtPriceRange'] != null
      ? PriceRange.fromJson(json['compareAtPriceRange'])
      : null;
  productType = json['productType'];
  if (json['variants'] != null) {
    variants = <Variants>[];
    json['variants'].forEach((v) {
      variants!.add(Variants.fromJson(v));
    });
  }
}