CartItem class

Constructors

CartItem({bool? free, String? id, String? kind, String? name, int? priceCents, int? quantity, String? sku})
Returns a new CartItem instance.

Properties

free ↔ bool?
Free reports a line that costs nothing because a coupon or a promotion made it so, rather than because its price is zero.
getter/setter pair
hashCode → int
The hash code for this object.
no setteroverride
id ↔ String?
ID is the line's identity — the variant id when the line is a variant, otherwise the product id. It is what a subsequent set call addresses.
getter/setter pair
kind ↔ String?
Kind is "variant" when this line is a specific sellable variant and "product" when it is the product itself.
getter/setter pair
name ↔ String?
Name is the item's display name, cached onto the line when it was added so a cart renders without a second read.
getter/setter pair
priceCents ↔ int?
PriceCents is the unit price in whole cents, cached at the moment the line was added. The line's contribution to the cart is this times Quantity.
getter/setter pair
quantity ↔ int?
Quantity is how many units of this item the cart holds.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sku ↔ String?
SKU is the line's stock-keeping unit — the variant's when it has one, otherwise the product's. Empty when neither carries one.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

fromJson(dynamic value) → CartItem?
Returns a new CartItem instance and imports its values from value if it's a Map, null otherwise.
listFromJson(dynamic json, {bool growable = false}) → List<CartItem>
mapFromJson(dynamic json) → Map<String, CartItem>
mapListFromJson(dynamic json, {bool growable = false}) → Map<String, List<CartItem>>

Constants

requiredKeys → const Set<String>
The list of required keys that must be present in a JSON.