flexi_cart library

Classes

BehaviorOptions
Behavior overrides for internal cart logic.
CartContainsValidator
Validator that checks if the cart contains a specific item
CartCurrency
Represents a currency with an exchange rate and currency code.
CartDiff<T>
Represents the difference between two states of a cart.
CartHooks
Hooks for cart operations, allowing for custom actions on add, delete, and checkout.
CartInput<T extends ICartItem>
A highly customizable and reusable quantity input widget for cart items.
CartInputNumberFormatter
A base formatter that normalizes Arabic digits, enforces numeric-only input, limits decimal precision, and optionally constrains values to a maximum.
CartInputStyle
Defines visual and structural styles for FlexiCart widgets.
CartInputTheme
A custom ThemeExtension for the FlexiCart package.
CartItemsGroup<T extends ICartItem>
A group of cart items of type T, each identified by a unique key.
CartMaxItemCountValidator
Validator that checks if the total number of items in the cart
CartMaxLengthValidator
Validator that checks if the number of different item types in the cart
CartMaxTotalValidator
Validator that checks if the number of different item types in the cart
CartMinLengthValidator
Validator that checks if the number of different item types in the cart
CartMinTotalValidator
Validator that checks if the number of different item types in the cart
CartNotEmptyValidator
Validator that checks if the number of different item types in the cart
CartOptions
A configuration class that bundles all customizable options for a FlexiCart instance.
CartPriceInputFormatter
A formatter for price input fields that supports Arabic numerals and customizable decimal precision.
CartQuantityInputFormatter
A formatter for quantity input fields that supports Arabic numerals and limits decimal places to fractionCount.
CartRequiredFieldValidator
Validator that checks if the number of different item types in the cart
CartValidatorKeys
A utility class that defines standard keys used for cart validation messages.
CartValidators
Provides a set of built-in cart validators for FlexiCart instances.
FlexiCart<T extends ICartItem>
A reactive and extensible shopping cart that supports item grouping, custom metadata, locking, expiration, and plugin extensions.
ICartCacheProvider
Optional: an abstraction over storage so users can provide their own provider
ICartItem
An abstract model representing a single item in a cart.
ICartPlugin<T extends ICartItem>
Interface for plugins that want to be notified when the cart changes.
ICartValidator
Interface for validating a FlexiCart instance.
ValidatorOptions
Signature for a function that validates a FlexiCart instance.

Mixins

CartChangeNotifierDisposeMixin
A mixin that adds a disposed flag to ChangeNotifier, and ensures notifyListeners() only works when the object hasn't been disposed.
CartHistoryMixin
mixin CartHistoryMixin; // A mixin that provides a history of actions or messages related to the cart.
CartLockMixin
A mixin that provides lock/unlock functionality to a cart.
CartMetadataMixin
mixin for change notifier dispose
CartPluginsMixin<T extends ICartItem>
Mixin for managing cart plugins that respond to cart events.
CartStreamMixin<T>
A mixin that provides a reactive stream interface for emitting state changes or values of type T.

Extensions

CartItemIterableExtension on Iterable<ICartItem>
Extension methods for list/iterable of cart items.

Functions

calculateCartDiff<T extends ICartItem>(Map<String, T> oldItems, Map<String, T> newItems) CartDiff<T>
Calculates the difference between two item maps (old vs. new).

Exceptions / Errors

CartDisposedException
Exception thrown when an operation is attempted on a disposed cart.
CartLockedException
Exception thrown when an operation is attempted on a locked cart.