Product class

The product

Annotations
  • @freezed
  • @JsonSerializable(createFactory: false)

Constructors

Product({required String title, required String id, required bool availableForSale, required String createdAt, required List<ProductVariant> productVariants, required String productType, required String publishedAt, required List<String> tags, required String updatedAt, required List<ShopifyImage> images, required List<Option> options, required String vendor, required List<ProductMedia> media, List<AssociatedCollections>? collectionList, String? cursor, String? onlineStoreUrl, String? description, String? descriptionHtml, String? handle})
The product constructor
factory
Product.fromGraphJson(Map<String, dynamic> json)
The product from graphjson
factory
Product.fromJson(Map<String, dynamic> json)
The product from json
factory

Properties

availableForSale bool
no setterinherited
collectionList List<AssociatedCollections>?
no setterinherited
compareAtPrice double
return the first product variant compareAtPrice amount or 0 if the list is empty
no setter
compareAtPriceFormatted String
return the first product variant compareAtPrice formatted or empty string if the list is empty
no setter
copyWith → $ProductCopyWith<Product>
Create a copy of Product with the given fields replaced by the non-null parameter values.
no setterinherited
createdAt String
no setterinherited
currencyCode String
returns cuurency code of the first product variant or empty string if the list is empty
no setter
cursor String?
no setterinherited
description String?
no setterinherited
descriptionHtml String?
no setterinherited
formattedPrice String
return the first product variant price formatted or empty string if the list is empty
no setter
handle String?
no setterinherited
hasComparablePrice bool
return bool if compareAtPrice is greater than price
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
no setterinherited
image String
returns first image src or a placeholder image
no setter
images List<ShopifyImage>
no setterinherited
isAvailableForSale bool
Checks if the product is available for sale by checking its variants availability and quantity
no setter
media List<ProductMedia>
no setterinherited
onlineStoreUrl String?
no setterinherited
options List<Option>
no setterinherited
price double
return the first product variant price amount or 0 if the list is empty
no setter
productType String
no setterinherited
productVariants List<ProductVariant>
no setterinherited
publishedAt String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags List<String>
no setterinherited
title String
no setterinherited
updatedAt String
no setterinherited
vendor String
no setterinherited

Methods

compareAtPriceFormattedWithLocale(String? locale) String
return the first product variant compareAtPrice amount or '' if the list is empty
formattedPriceWithLocale(String? locale) String
return the first product variant price formatted with locale or empty string if the list is empty
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
The product to json
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited