Data.fromMap constructor

Data.fromMap(
  1. Map<String, dynamic> json
)

Implementation

factory Data.fromMap(Map<String, dynamic> json) => Data(
      pricing:
          json["pricing"] == null ? null : Pricing.fromMap(json["pricing"]),
      inventory: json["inventory"] == null
          ? null
          : Inventory.fromMap(json["inventory"]),
      extra: json["extra"],
      id: json["id"],
      title: json["title"],
      slug: json["slug"],
      code: json["code"],
      gender: json["gender"],
      description: json["description"],
      createdAt: json["created_at"],
      specifications: json["specifications"],
      updatedAt: json["updated_at"],
      freeDelivery: json["free_delivery"],
      exemptVat: json["exempt_vat"],
      hasVariants: json["has_variants"],
      checkoutMessage: json["checkout_message"],
      demoLink: json["demo_link"],
      demoLinkType: json["demo_link_type"],
      ageGroup: json["age_group"],
      seoUrl: json["seo_url"],
      shortUrl: json["short_url"],
      seoDesc: json["seo_desc"],
      seoTags: json["seo_tags"],
      seoTitle: json["seo_title"],
      tags: json["tags"],
      shippingDurationMax: json["shipping_duration_max"],
      shippingDurationMetric: json["shipping_duration_metric"],
      shippingRequired: json["shipping_required"],
      shippingDurationMin: json["shipping_duration_min"],
      weight: json["weight"],
      price: json["price"],
      qty: json["qty"],
      weightUnit: json["weight_unit"],
      status: json["status"],
      mainImageId: json["main_image_id"],
      hasExpiry: json["has_expiry"],
      expiryDate: json["expiry_date"],
      manufacturingDate: json["manufacturing_date"],
      productTypeCode: json["product_type_code"],
      maxBillingCount: json["max_billing_count"],
      billingCycle: json["billing_cycle"],
      categoryId: json["category_id"],
      brandId: json["brand_id"],
      warehouseId: json["warehouse_id"],
      supplierId: json["supplier_id"],
      images: json["images"] == null
          ? []
          : List<Image>.from(json["images"]!.map((x) => Image.fromMap(x))),
      variants: json["variants"] == null
          ? []
          : List<Variant>.from(
              json["variants"]!.map((x) => Variant.fromMap(x))),
      variantCombinations: json["variant_combinations"] == null
          ? []
          : List<VariantCombination>.from(json["variant_combinations"]!
              .map((x) => VariantCombination.fromMap(x))),
      isDefault: json["is_default"],
      shareLinks: json["share_links"],
      relatedProducts: json["related_products"],
      productType: json["product_type"],
      category: json["category"],
      brand: json["brand"],
      supplier: json["supplier"],
      collections: json["collections"] == null
          ? []
          : List<dynamic>.from(json["collections"]!.map((x) => x)),
      salesChannels: json["sales_channels"] == null
          ? []
          : List<dynamic>.from(json["sales_channels"]!.map((x) => x)),
      downloadables: json["downloadables"] == null
          ? []
          : List<dynamic>.from(json["downloadables"]!.map((x) => x)),
      warehouse: json["warehouse"],
      mediumImageUrl: json["medium_image_url"],
      thumbnailImageUrl: json["thumbnail_image_url"],
    );