clearCartStorage method
Clear cart storage without triggering an API call Use this after checkout success to prevent stale cart data from being sent on subsequent screen views Resets initialization flag so next cart update is treated as initialization (no automatic push) Marks cart as changed so next screen view tracks the cart state change
Implementation
Future<void> clearCartStorage() async {
final storage = HiveStorageService.instance;
await storage.setCartData(jsonEncode(Cart.active([]).toMap()));
_cartChanged = true; // Cart state changed from paid to empty
_cartInitialized = false; // Reset so next cart load doesn't trigger automatic push
debugPrint('Cart storage cleared, marked as changed, and initialization flag reset (no API call)');
}