WooProduct.fromJson constructor

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

Implementation

WooProduct.fromJson(Map<String, dynamic> json)
    : id = json['id'],
      name = json['name'],
      slug = json['slug'],
      permalink = json['permalink'],
      type = json['type'],
      status = json['status'],
      featured = json['featured'],
      catalogVisibility = json['catalog_visibility'],
      description = json['description'],
      shortDescription = json['short_description'],
      sku = json['sku'],
      price = json['price'],
      regularPrice = json['regular_price'],
      salePrice = json['sale_price'],
      priceHtml = json['price_html'],
      onSale = json['on_sale'],
      purchasable = json['purchasable'],
      totalSales = json['total_sales'],
      virtual = json['virtual'],
      downloadable = json['downloadable'],
      downloads = (json['downloads'] as List)
          .map((i) => WooProductDownload.fromJson(i))
          .toList(),
      downloadLimit = json['download_limit'],
      downloadExpiry = json['download_expiry'],
      externalUrl = json['external_url'],
      buttonText = json['button_text'],
      taxStatus = json['tax_status'],
      taxClass = json['tax_class'],
      manageStock = json['manage_stock'],
      stockQuantity = json['stock_quantity'],
      stockStatus = json['stock_status'],
      backorders = json['backorders'],
      backordersAllowed = json['backorders_allowed'],
      backordered = json['backordered'],
      soldIndividually = json['sold_individually'],
      weight = json['weight'],
      dimensions = WooProductDimension.fromJson(json['dimensions']),
      shippingRequired = json['shipping_required'],
      shippingTaxable = json['shipping_taxable'],
      shippingClass = json['shipping_class'],
      shippingClassId = json['shipping_class_id'],
      reviewsAllowed = json['reviews_allowed'],
      averageRating = json['average_rating'],
      ratingCount = json['rating_count'],
      relatedIds = json['related_ids'].cast<int>(),
      upsellIds = json['upsell_ids'].cast<int>(),
      crossSellIds = json['cross_sell_ids'].cast<int>(),
      parentId = json['parent_id'],
      purchaseNote = json['purchase_note'],
      categories = (json['categories'] as List)
          .map((i) => WooProductCategory.fromJson(i))
          .toList(),
      tags = (json['tags'] as List)
          .map((i) => WooProductItemTag.fromJson(i))
          .toList(),
      images = (json['images'] as List)
          .map((i) => WooProductImage.fromJson(i))
          .toList(),
      attributes = (json['attributes'] as List)
          .map((i) => WooProductItemAttribute.fromJson(i))
          .toList(),
      defaultAttributes = (json['default_attributes'] as List)
          .map((i) => WooProductDefaultAttribute.fromJson(i))
          .toList(),
      variations = json['variations'].cast<int>(),
      groupedProducts = json['grouped_products'].cast<int>(),
      menuOrder = json['menu_order'],
      metaData = (json['meta_data'] as List)
          .map((i) => MetaData.fromJson(i))
          .toList();