toJson method
Implementation
Map<String, dynamic> toJson() {
return {
if (timeList != null) "timeList": timeList,
if (id != null) "id": id,
"name": name,
if (slug != null) "slug": slug,
if (permalink != null) "permalink": permalink,
if (type != null) "type": type,
if (status != null) "status": status,
if (featured != null) "featured": featured,
if (catalogVisibility != null) "catalog_visibility": catalogVisibility,
if (description != null) "description": description,
if (shortDescription != null) "short_description": shortDescription,
if (sku != null) "sku": sku,
if (Productprice != null) "price": Productprice,
if (Price != null) "regular_price": Price,
if (salePrice != null) "sale_price": salePrice,
if (priceHtml != null) "price_html": priceHtml,
if (onSale != null) "on_sale": onSale,
if (purchasable != null) "purchasable": purchasable,
if (totalSales != null) "total_sales": totalSales,
if (virtual != null) "virtual": virtual,
if (downloadable != null) "downloadable": downloadable,
if (downloads != null) "downloads": downloads,
if (downloadLimit != null) "download_limit": downloadLimit,
if (downloadExpiry != null) "download_expiry": downloadExpiry,
if (externalUrl != null) "external_url": externalUrl,
if (buttonText != null) "button_text": buttonText,
if (taxStatus != null) "tax_status": taxStatus,
if (taxClass != null) "tax_class": taxClass,
if (manageStock != null) "manage_stock": manageStock,
if (stockQuantity != null) "stock_quantity": stockQuantity,
if (stockStatus != null) "stock_status": stockStatus,
if (backorders != null) "backorders": backorders,
if (backordersAllowed != null) "backorders_allowed": backordersAllowed,
if (backorders != null) "backordered": backordered,
if (soldIndividually != null) "sold_individually": soldIndividually,
if (weight != null) "weight": weight,
if (dimensions != null) "dimensions": dimensions,
if (shippingRequired != null) "shipping_required": shippingRequired,
if (shippingTaxable != null) "shipping_taxable": shippingTaxable,
if (shippingClass != null) "shipping_class": shippingClass,
if (shippingClassId != null) "shipping_class_id": shippingClassId,
if (reviewsAllowed != null) "reviews_allowed": reviewsAllowed,
if (averageRating != null) "average_rating": averageRating,
if (ratingCount != null) "rating_count": ratingCount,
if (relatedIds != null) "related_ids": relatedIds,
if (upsellIds != null) "upsell_ids": upsellIds,
if (crossSellIds != null) "cross_sell_ids": crossSellIds,
if (parentId != null) "parent_id": parentId,
if (purchaseNote != null) "purchase_note": purchaseNote,
if (images != null)
'images': images != null ? images!.map((i) => i.toJson()).toList() : [],
if (categories != null)
// 'categories': [
// {'id': categories}
// ],
'categories': categories != null
? categories!.map((i) => i.toJson()).toList()
: [],
if (tags != null)
'tags': tags != null ? tags!.map((i) => i.toJson()).toList() : [],
if (attributes != null)
"attributes": attributes != null
? attributes!.map((i) => i.toJson()).toList()
: [],
if (defaultAttributes != null) "default_attributes": defaultAttributes,
if (variations != null) "variations": variations,
if (groupedProducts != null) "grouped_products": groupedProducts,
if (menuOrder != null) "menu_Order": menuOrder,
if (metaData != null) "meta_Data": metaData,
if (dateCreated != null) "date_created": dateCreated,
if (dateCreatedGMT != null) "date_created_gmt": dateCreatedGMT,
};
}