Order Detail Provider
orderDetailProvider · FutureProvider.family<Order, String>
Overview
Single-order fetcher that watches userRoleProvider and routes to /vendor/orders/{id} for sellers, /store/orders/{id} for customers. Same family pattern is consumed by both customer and seller detail screens.
User Flow
- ref.watch(userRoleProvider) → isSeller flag.
- OrderService.getOrder(orderId, isSeller: isSeller) hits the right endpoint with the right field selection.
- Order goes into the FutureProvider.family cache keyed by orderId.
Cases & Edge Cases
- Role-switch in-session invalidates the cache for this family key — the next read refetches via the right endpoint.
- Seller endpoint adds the query fields='*customer,+payment_status,*split_order_payment' to inline data the seller UI needs.
Code References
- lib/src/features/shared/orders/controllers/order_controller.dart:29 // orderDetailProvider
- lib/src/core/services/order_service.dart:44 // getOrder(isSeller)
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Family providers leak entries unless invalidated — call ref.invalidate(orderDetailProvider(orderId)) after mutations.