Cart class

Constructors

Cart({String? createdAt, String? currency, int? discountCents, String? email, String? id, List<CartItem> items = const [], int? lineTotalCents, String? order, int? shippingCents, String? status, String? store, int? subtotalCents, int? taxCents, int? totalCents, String? updatedAt, String? user})
Returns a new Cart instance.

Properties

createdAt ↔ String?
CreatedAt is when the cart was opened, RFC3339.
getter/setter pair
currency ↔ String?
Currency is the ISO 4217 code every amount below is denominated in.
getter/setter pair
discountCents ↔ int?
DiscountCents is what coupons and promotions took off, in whole cents.
getter/setter pair
email ↔ String?
Email is the shopper's address, when the cart carries one.
getter/setter pair
hashCode → int
The hash code for this object.
no setteroverride
id ↔ String?
ID is the cart's id — what every other cart op addresses it by, and what a storefront persists against the browser session.
getter/setter pair
items ↔ List<CartItem>
Items are the cart's lines, in the order they were added.
getter/setter pair
lineTotalCents ↔ int?
LineTotalCents is the sum of the lines before any discount, in whole cents.
getter/setter pair
order ↔ String?
Order is the order this cart became, once checkout completed it. Empty until then, and its presence is what makes a cart final.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shippingCents ↔ int?
ShippingCents is the shipping charge, in whole cents. It stays zero until a shipping option is priced at checkout.
getter/setter pair
status ↔ String?
Status is "active" for a cart still being filled, "ordered" once checkout turned it into an order, and "discarded" when the shopper abandoned it.
getter/setter pair
store ↔ String?
Store is the storefront the cart is being filled on.
getter/setter pair
subtotalCents ↔ int?
SubtotalCents is LineTotalCents less DiscountCents, in whole cents.
getter/setter pair
taxCents ↔ int?
TaxCents is the sales tax, in whole cents. It stays zero until checkout resolves the shopper's tax region.
getter/setter pair
totalCents ↔ int?
TotalCents is what the shopper pays: subtotal plus shipping plus tax, in whole cents.
getter/setter pair
updatedAt ↔ String?
UpdatedAt is when the cart was last amended, RFC3339.
getter/setter pair
user ↔ String?
User is the signed-in shopper this cart belongs to, empty for a guest cart.
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) → Cart?
Returns a new Cart instance and imports its values from value if it's a Map, null otherwise.
listFromJson(dynamic json, {bool growable = false}) → List<Cart>
mapFromJson(dynamic json) → Map<String, Cart>
mapListFromJson(dynamic json, {bool growable = false}) → Map<String, List<Cart>>

Constants

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