Access Contact List in Low-Connectivity or Offline Scenarios
The Contact Repository caches contact data locally using Riverpod with periodic background refresh when connectivity is available. When the app detects a low-connectivity or offline scenario, the Contact List BLoC serves the most recently cached data and displays a subtle indicator that the list may not reflect the latest updates. Background refresh occurs automatically when connectivity is restored, updating the cache without requiring user action. This pattern supports peer mentors who use the app in the field after completing a peer support visit, where network access is not guaranteed.
User Story
Acceptance Criteria
- Given a user has previously opened the Contacts screen with internet access, when they open the screen without internet connectivity, then the cached contact list is displayed
- Given the app is offline, when the contact list is showing cached data, then a visible indicator informs the user that data may be outdated
- Given the app regains internet connectivity, when the refresh triggers, then the contact list updates automatically in the background without requiring user action
- Given a user searches while offline, when they type in the search bar, then search operates against the local cache and returns matching cached results
- Given the cache is empty (first launch, no prior data), when the app is offline, then an appropriate empty state message is shown rather than an error
Business Value
Peer mentors frequently use the app immediately after completing a peer support visit — often in locations with poor connectivity such as private homes, care facilities, or rural areas. The inability to access contact information offline would make the app unreliable for field use, reducing adoption and defeating the core purpose. Offline support ensures the app works in real-world conditions, not just ideal ones.
Components
- Contact Repository data
- Contact List BLoC service
- Contact Search Service service
- Contacts List Screen ui