UserProfileIds Provider
personal_info_provider.dart · userProfileIdsProvider + currentCustomerIdProvider
Overview
FutureProvider that fetches the authenticated user's customer ID (always) and seller ID (only when role==freelancer) in parallel and returns both. currentCustomerIdProvider selects the active one based on role — consumed by the cart, wishlist, and post-author scoping.
User Flow
- Watches authStateProvider; bails to empty when !isLoggedIn.
- Spawns UserService.getClientInfo + (if freelancer) VendorService.getSellerProfile in Future.wait.
- currentCustomerIdProvider re-reads userProfileIdsProvider + role and returns sellerId or customerId.
- sellerProfileRawProvider exposes the full raw seller payload (used by trades/metiers UI).
- currentSellerTradesProvider derives the métier list from the raw seller via parseSellerTrades.
Cases & Edge Cases
- Clients NEVER hit /vendor/sellers/me — the role gate exists specifically to suppress 2 wasted 401 requests per home boot.
- Both fetches swallow their own errors so a failure in one branch doesn't blank the other.
- AuthState equality override (see auth feature) prevents userProfileIdsProvider from refetching on every login-flag tick.
Code References
- lib/src/features/shared/profile/personal_info_provider.dart:10 // UserProfileIds
- lib/src/features/shared/profile/personal_info_provider.dart:61 // currentCustomerIdProvider
- lib/src/features/shared/profile/personal_info_provider.dart:85 // userProfileIdsProvider
- lib/src/features/shared/profile/personal_info_provider.dart:124 // sellerProfileRawProvider
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Several other features (cart, wishlist) take a hard dependency on currentCustomerIdProvider — keep its semantics stable.