persistent_shopping_cart 0.0.1 copy "persistent_shopping_cart: ^0.0.1" to clipboard
persistent_shopping_cart: ^0.0.1 copied to clipboard

Effortlessly manage and persist shopping cart data in your Flutter app with this comprehensive package. Simplify local storage and enhance the shopping experience for your users.

example/lib/main.dart

// exampl's main.dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:persistent_shopping_cart/model/cart_model.dart';
import 'package:persistent_shopping_cart/persistent_shopping_cart.dart';
import 'package:persistent_shopping_cart_example/view/products/products_view.dart';

void main() async {
  final persistentShoppingCart = PersistentShoppingCart();

  await persistentShoppingCart.init();
  await persistentShoppingCart.registerAdapters();
  await persistentShoppingCart.openCartBox();

  final jsonString = await persistentShoppingCart.readJsonFromAsset('../assets/cart.json');
  final jsonData = json.decode(jsonString);

  final cartModel = CartModel.fromJson(jsonData);
  await persistentShoppingCart.addCartToBox(cartModel);

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const ProductsView(),
    );
  }
}
258
likes
0
points
201
downloads

Publisher

unverified uploader

Weekly Downloads

Effortlessly manage and persist shopping cart data in your Flutter app with this comprehensive package. Simplify local storage and enhance the shopping experience for your users.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, hive, hive_flutter, path_provider

More

Packages that depend on persistent_shopping_cart