arch-atlas

Cart Provider Wiring

NotifierProviders for the cart feature

di

Overview

Two NotifierProviders are exported: cartControllerProvider (the local cart list) and cartSelectionProvider (the selected variantIds). The backend CartService is plain — instantiated where needed; not provider-wrapped today.

User Flow

  1. cartControllerProvider builds with currentCustomerIdProvider as a watched dependency.
  2. cartSelectionProvider builds with cartControllerProvider as a watched dependency.
  3. Consumers (CartScreen, CheckoutScreen, AddToCart buttons) ref.watch / ref.read these providers directly.
  4. CartService is constructed inline in CheckoutController and other consumers — no provider gate.

Cases & Edge Cases

  • Adding a provider for CartService would let tests inject a mock — currently not done.
  • Provider disposal is implicit — they live for the app lifetime since nothing else holds a parent scope.

Code References

  • lib/src/features/shared/cart/controllers/cart_controller.dart:130 // cartControllerProvider
  • lib/src/features/shared/cart/controllers/cart_selection_controller.dart:30 // cartSelectionProvider

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

currentCustomerIdProvider lives in profile/personal_info_provider.dart — see the profile feature for its definition.