PersistentShoppingCartItem class

Represents an item in the shopping cart with persistent storage capabilities.

This class is annotated with Hive type and fields annotations for serialization.

Annotations
  • @HiveType(typeId: 0)

Constructors

PersistentShoppingCartItem({required String productId, required String productName, String? productThumbnail, String? productDescription, List<String>? productImages, required double unitPrice, required int quantity, Map<String, dynamic>? productDetails})
Creates a PersistentShoppingCartItem instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
key String
Getter for the key, using the productId as the key.
no setter
productDescription String?
The optional description of the product.
final
productDetails Map<String, dynamic>?
The optional details of the product.
final
productId String
The unique identifier for the product.
final
productImages List<String>?
The optional list of image URLs for the product.
final
productName String
The name of the product.
final
productThumbnail String?
The optional thumbnail image URL for the product.
final
quantity int
The quantity of the product in the shopping cart.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalPrice double
Calculates the total price for this item.
no setter
unitPrice double
The unit price of the product.
final

Methods

decrement() → void
Decrements the quantity of this item, ensuring it doesn't go below zero.
increment() → void
Increments the quantity of this item.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the PersistentShoppingCartItem instance to a Map.
toString() String
A string representation of this object.
inherited

Operators

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