Contact List Riverpod Provider
Component Detail
Description
Riverpod providers that expose role-aware contact and peer mentor streams to the UI layer. Manages loading, error, and data states using AsyncValue and automatically re-fetches when the authenticated user's role or organization context changes.
contact-list-riverpod-provider
Summaries
The Contact List Riverpod Provider is the real-time intelligence layer that ensures the contact list always reflects the current user's role, organization, and search state without requiring manual refreshes. For end users, this translates to a contact list that stays accurate as organizational context changes — preventing staff from working with stale data that could lead to incorrect outreach or support decisions. For the business, automated state management reduces support tickets related to 'wrong contacts showing' and builds user trust in the platform's reliability. Its reactive architecture also means new role types or organizational structures can be accommodated with minimal UI-layer changes, reducing future development cost.
Contact List Riverpod Provider is a medium-complexity state management layer that depends on contact-repository being complete and stable. Its reactive nature — auto-refreshing when auth context or organization changes — requires careful coordination with the authentication feature team to ensure the session and organization context providers are available and correctly structured before integration. The AsyncValue pattern (loading, error, data states) introduces UI states that all consuming widgets must handle, meaning UI developers need clear contracts for all three states before building screens against this provider. Plan for integration testing that simulates auth context switches and org changes.
Because it is not marked as shared, its scope is bounded to the contact list feature, limiting blast radius of changes.
ContactListRiverpodProvider exposes a set of Riverpod providers that bridge the service layer to the Flutter widget tree. `contactListProvider` and `peerMentorListProvider` are `AsyncNotifierProvider` or `FutureProvider` instances returning `AsyncValue>` and `AsyncValue
>` respectively, delegating to `ContactListService`. `contactSearchQueryProvider` is a `StateProvider
`selectedContactViewProvider` is a `StateProvider
Responsibilities
- Provide role-aware AsyncValue<List<Contact>> to UI widgets
- Provide role-aware AsyncValue<List<PeerMentor>> to UI widgets
- Expose search query state and trigger filtered fetches on query change
- Invalidate and refresh on auth context or organization change
Interfaces
contactListProvider
peerMentorListProvider
contactSearchQueryProvider
filteredContactListProvider
filteredPeerMentorListProvider
selectedContactViewProvider