flutter_cart 0.0.5+1 flutter_cart: ^0.0.5+1 copied to clipboard
A flutter package for the cart management. This package helps you to perform basic cart operation like (Add to cart, Remove from cart, Get total count) etc.
import 'package:flutter_cart/flutter_cart.dart';
class SampleClass {
var message;
/// Creating the instance of flutter cart package.
var cart = FlutterCart();
/// sample function
addToCart(dynamic _product) => {
message = cart.addToCart(
productId: _product.productId,
unitPrice: _product.productPrice,
quantity: _product.quantity,
///[uniqueCheck] is used to differentiate the type between item
///[e.g] the shirt sizes in (LARGE, MEDIUM, SMALL) the [Product ID] will remain same
///But if UUID is not present so, how we can differentiate between them? So in this case we will
///User the uniqueCheck
uniqueCheck: _product.selectedProductType,
///[productDetailsObject] is used as a dump variable you can dump your object and any kind of data
///that you wanted use in future.
productDetailsObject: _product),
};
/// This function is used to decrement the item quantity from cart
removeItemFromCart(int index) => {
cart.decrementItemFromCart(index),
};
/// This function is used to increment the item quantity into cart
addItemToCart(int index) {
cart.incrementItemToCart(index);
}
}
void main() {
var yourObject;
SampleClass().addItemToCart(yourObject);
}