arch-atlas

Seller Products Controller

products/providers/seller_products_provider.dart · StateNotifier.autoDispose

domain

Overview

AutoDispose StateNotifier that loads the seller's products from /vendor/products and exposes deleteProduct. AsyncValue<List<SellerProduct>> backs the list screen.

User Flow

  1. Ctor → fetch() → VendorService.getPhysicalProductsRaw → SellerProduct.fromJson × N.
  2. deleteProduct: optimistic removal after VendorService.deletePhysicalProduct succeeds.
  3. AsyncLoading on every fetch — pull-to-refresh works out of the box.

Cases & Edge Cases

  • deletePhysicalProduct can fail if inventory or active line items reference the product — server message is propagated.
  • AutoDispose forces a refetch every time the screen mounts — by design, since seller stock may change.

Code References

  • lib/src/features/seller/products/providers/seller_products_provider.dart:7 // sellerProductsProvider
  • lib/src/features/seller/products/providers/seller_products_provider.dart:13 // SellerProductsController

API Calls

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

Notes

Pagination not implemented yet — relies on the backend default limit. Add cursor support if seller catalogs grow large.