import 'package:flutter/material.dart'; import 'package:rijig_mobile/core/api/api_services.dart'; import 'package:rijig_mobile/features/cart/model/cartitem_model.dart'; class CartService { final Https _https = Https(); Future postCart(List items) async { final body = {"items": items.map((e) => e.toJson()).toList()}; await _https.post("/cart", body: body); } Future getCart() async { final response = await _https.get("/cart"); debugPrint(response); return CartResponse.fromJson(response['data']); } Future deleteCartItem(String trashId) async { await _https.delete("/cart/$trashId"); } Future clearCart() async { await _https.delete("/cart"); } Future refreshCartTTL() async { await _https.put("/cart/refresh"); } Future commitCart() async { await _https.post("/cart/commit"); } }