arch-atlas

Checkout Provider

checkoutControllerProvider · NotifierProvider

di

Overview

Single NotifierProvider for the entire checkout. No autoDispose, so state survives screen pops and lets the resume-from-pending-checkout flow work. CartService and ProvisionService are instantiated inside the notifier — not provider-wrapped.

User Flow

  1. CheckoutScreen ref.watch(checkoutControllerProvider) on every state change.
  2. CheckoutController constructs CartService() and ProvisionService() in field initializers.
  3. Other consumers (orders feature) ref.read this provider only after a completed checkout to read state.checkoutCart.

Cases & Edge Cases

  • Lack of autoDispose means a stale CheckoutState lingers if the user starts a checkout, leaves the app, and starts a new flow days later — the controller does NOT auto-reset.
  • Inline service construction is fine for prod but means tests can't inject mocks without overrideWith.

Code References

  • lib/src/features/shared/checkout/controllers/checkout_controller.dart:437 // checkoutControllerProvider

API Calls

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

Notes

Switching to AutoDisposeNotifierProvider would simplify reasoning but break the resume-after-back flow — make the swap deliberate.