HomeViewModel
Component Detail
Description
A Riverpod StateNotifier that combines module registry enablement state and the active role context from the role provider into a single reactive HomeState object consumed by both home screen variants. Handles role switch events and ensures the navigation stack is not reset on role change.
home-view-model
Sources & reasoning
The HomeViewModel is the single state owner for the home screens, merging two asynchronous concerns - module enablement and active role - into one object. Centralising this avoids race conditions between role switches and module state refreshes, and cleanly supports the requirement that role switching must not reset the navigation stack.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Combine module registry state with active role context into HomeState
- Expose a unified reactive HomeState to home screen UI layers
- Process role switch events and update state without stack reset
- Manage loading and error states during bootstrap data fetch
Interfaces
homeState → AsyncValue<HomeState>
onRoleSwitch(Role newRole) → void
refresh() → Future<void>
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component