toJson method
Implementation
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"slug": slug,
"permalink": permalink,
"date_created": dateCreated!.toIso8601String(),
"date_created_gmt": dateCreatedGmt!.toIso8601String(),
"date_modified": dateModified!.toIso8601String(),
"date_modified_gmt": dateModifiedGmt!.toIso8601String(),
"type": type,
"status": status,
"featured": featured,
"catalog_visibility": catalogVisibility,
"description": description,
"short_description": shortDescription,
"sku": sku,
"price": price,
"regular_price": regularPrice,
"sale_price": salePrice,
"date_on_sale_from": dateOnSaleFrom,
"date_on_sale_from_gmt": dateOnSaleFromGmt,
"date_on_sale_to": dateOnSaleTo,
"date_on_sale_to_gmt": dateOnSaleToGmt,
"price_html": priceHtml,
"on_sale": onSale,
"purchasable": purchasable,
"total_sales": totalSales,
"virtual": virtual,
"downloadable": downloadable,
"downloads": List<dynamic>.from(downloads!.map((x) => x.toJson())),
"download_limit": downloadLimit,
"download_expiry": downloadExpiry,
"external_url": externalUrl,
"button_text": buttonText,
"tax_status": taxStatus,
"tax_class": taxClass,
"manage_stock": manageStock,
"stock_quantity": stockQuantity,
"stock_status": stockStatus,
"backorders": backorders,
"backorders_allowed": backordersAllowed,
"backordered": backordered,
"sold_individually": soldIndividually,
"weight": weight,
"dimensions": dimensions!.toJson(),
"shipping_required": shippingRequired,
"shipping_taxable": shippingTaxable,
"shipping_class": shippingClass,
"shipping_class_id": shippingClassId,
"reviews_allowed": reviewsAllowed,
"average_rating": averageRating,
"rating_count": ratingCount,
"related_ids": List<dynamic>.from(relatedIds!.map((x) => x)),
"upsell_ids": List<dynamic>.from(upsellIds!.map((x) => x)),
"cross_sell_ids": List<dynamic>.from(crossSellIds!.map((x) => x)),
"parent_id": parentId,
"purchase_note": purchaseNote,
"categories": List<dynamic>.from(categories!.map((x) => x.toJson())),
"tags": List<dynamic>.from(tags!.map((x) => x)),
"images": List<dynamic>.from(images!.map((x) => x.toJson())),
"attributes": List<dynamic>.from(attributes!.map((x) => x.toJson())),
"default_attributes":
List<dynamic>.from(defaultAttributes!.map((x) => x.toJson())),
"variations": List<dynamic>.from(variations!.map((x) => x)),
"grouped_products": List<dynamic>.from(groupedProducts!.map((x) => x)),
"menu_order": menuOrder,
"meta_data": List<dynamic>.from(metaData!.map((x) => x)),
"_links": links!.toJson(),
};