Product.fromJson constructor
Product.fromJson(
- dynamic json
Implementation
factory Product.fromJson(json) {
return Product(
// duration: durationn['value'],
// timeList: timeListt,
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'] is String
? json['sale_price']
: json['sale_price'].toString()),
priceHtml: json['price_html'],
onSale: json['on_sale'],
purchasable: json['purchasable'],
totalSales: json['total_sales'],
virtual: json['virtual'],
downloadable: json['downloadable'],
downloads: json['downloads'],
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'].toString(),
dimensions: 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'],
upsellIds: json['upsell_ids'],
crossSellIds: json['cross_sell_ids'],
parentId: json['parent_id'],
purchaseNote: json['purchase_note'],
categories: json['categories'],
tags: json['tags'],
images: json['images'],
attributes: (json['attributes'] as List)
.map((i) => Attribute.fromJson(i))
.toList(),
defaultAttributes: json['default_attributes'],
variations: json['variations'],
groupedProducts: json['grouped_products'],
menuOrder: json['menu_order'],
dateCreated: json['date_created'],
dateCreatedGMT: json['date_created_gmt'],
metaData: json['meta_data']);
}