Implement Supabase Client Provider as Riverpod Singleton
epic-peer-mentor-detail-screen-foundation-task-001 — Create a Riverpod Provider that exposes a single shared SupabaseClient instance for use across all repositories and data layers in the peer mentor detail feature. Configure it to read Supabase URL and anon key from environment configuration. Ensure the provider is scoped appropriately so all downstream providers receive the same client instance, preventing multiple connection pools.
Acceptance Criteria
Technical Requirements
Implementation Notes
Initialize Supabase in `main.dart` with `await Supabase.initialize(url: ..., anonKey: ...)` before `runApp`. The provider body can then safely return `Supabase.instance.client` synchronously. Prefer `Provider
If the project uses `flutter_riverpod` with code generation (`@riverpod`), annotate with `@Riverpod(keepAlive: true)` to prevent disposal. Avoid putting business logic inside this provider — its sole responsibility is client exposure.
Testing Requirements
Write unit tests using `riverpod_test` / `ProviderContainer`. Test 1: provider returns a non-null `SupabaseClient` when valid env vars are present. Test 2: two sequential `read` calls return identical object instances (singleton). Test 3: provider throws `ConfigurationException` (or equivalent) when env vars are absent or empty.
No integration tests required at this layer; mock `SupabaseClient` for all downstream tests that depend on this provider.
The design token theme extension may conflict with existing ThemeData extensions already registered in the app, causing runtime assertion errors or token resolution failures across all screens that consume the tokens.
Mitigation & Contingency
Mitigation: Audit all existing ThemeData extensions before implementation. Use a unique extension key namespace and add integration tests that instantiate the combined theme in a test app harness.
Contingency: If conflicts arise, isolate design tokens behind a dedicated provider singleton (Riverpod) rather than a ThemeData extension, updating all consuming widgets to read from the provider instead.
The 30-day warning threshold for expiring_soon status may differ between HLF's stated requirement in workshops (60 days mentioned in user stories) and the 30-day value in component documentation, causing disagreement during acceptance testing.
Mitigation & Contingency
Mitigation: Explicitly confirm the threshold value with HLF stakeholder before implementation. Make the threshold a named constant (kCertificationWarnDays) so it can be updated without logic changes.
Contingency: If stakeholder confirms 60 days post-implementation, update the constant and re-run the unit test suite — no architectural change required.