Product class abstract

The product

Available extensions
Annotations
  • @freezed
  • @JsonSerializable.new(createFactory: false)

Constructors

Product({required String title, required String id, required bool availableForSale, required String createdAt, required List<ProductVariant> productVariants, required String productType, required List<String> tags, required List<ShopifyImage> images, required List<Option> options, required String vendor, required List<ProductMedia> media, required List<Metafield> metafields, List<AssociatedCollections>? collectionList, TaxonomyCategory? category, String? cursor, String? onlineStoreUrl, String? description, String? descriptionHtml, String? handle})
The product constructor
const
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
category → TaxonomyCategory?
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
Whether any variant of this product can currently be bought.
no setter
media → List<ProductMedia>
no setterinherited
metafields → List<Metafield>
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
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags → List<String>
no setterinherited
title → 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
map<TResult extends Object?>(TResult $default(_Product value)) → TResult

Available on Product, provided by the ProductPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_Product value)?) → TResult?

Available on Product, provided by the ProductPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_Product value)?, {required TResult orElse()}) → TResult

Available on Product, provided by the ProductPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String title, String id, bool availableForSale, String createdAt, List<ProductVariant> productVariants, String productType, List<String> tags, List<ShopifyImage> images, List<Option> options, String vendor, List<ProductMedia> media, List<Metafield> metafields, List<AssociatedCollections>? collectionList, TaxonomyCategory? category, String? cursor, String? onlineStoreUrl, String? description, String? descriptionHtml, String? handle)?, {required TResult orElse()}) → TResult

Available on Product, provided by the ProductPatterns extension

A variant of when that fallback to an orElse callback.
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
when<TResult extends Object?>(TResult $default(String title, String id, bool availableForSale, String createdAt, List<ProductVariant> productVariants, String productType, List<String> tags, List<ShopifyImage> images, List<Option> options, String vendor, List<ProductMedia> media, List<Metafield> metafields, List<AssociatedCollections>? collectionList, TaxonomyCategory? category, String? cursor, String? onlineStoreUrl, String? description, String? descriptionHtml, String? handle)) → TResult

Available on Product, provided by the ProductPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String title, String id, bool availableForSale, String createdAt, List<ProductVariant> productVariants, String productType, List<String> tags, List<ShopifyImage> images, List<Option> options, String vendor, List<ProductMedia> media, List<Metafield> metafields, List<AssociatedCollections>? collectionList, TaxonomyCategory? category, String? cursor, String? onlineStoreUrl, String? description, String? descriptionHtml, String? handle)?) → TResult?

Available on Product, provided by the ProductPatterns extension

A variant of when that fallback to returning null

Operators

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