CartItem class

Represents a single item in a shopping cart.

Contains product information, quantity, pricing, and optional variation attributes for variable products.

Annotations

Constructors

CartItem({required String id, required String productId, String? variationId, required String name, String? sku, required int quantity, required double price, required double subtotal, required double total, String? imageUrl, Map<String, dynamic>? variationAttributes, Map<String, dynamic>? extensions})
const
CartItem.fromJson(Map<String, dynamic> json)
factory

Properties

extensions → Map<String, dynamic>?
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
id → String
final
imageUrl → String?
final
name → String
final
price → double
final
productId → String
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
quantity → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sku → String?
final
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
subtotal → double
final
total → double
final
variationAttributes → Map<String, dynamic>?
final
variationId → String?
final

Methods

copyWith({String? id, String? productId, String? variationId, String? name, String? sku, int? quantity, double? price, double? subtotal, double? total, String? imageUrl, Map<String, dynamic>? variationAttributes, Map<String, dynamic>? extensions}) → CartItem
getExtension<T>(String key) → T?
inherited
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.

Operators

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