ScreenStore
The state and the effects of one screen.
An EventRouter creates one store, keeps it for as long as the router lives and hands it to every EventHandler it runs, so all the handlers of a screen read and write the same state. The UI never receives the store: it reads EventRouter.state and EventRouter.effects.
Create one yourself only in a test, to call a handler directly:
val store = ScreenStore<TaskListUiState, TaskListEffect>(TaskListUiState.Loading)
OnRefreshHandler(FakeTaskRepository()).handle(OnRefresh, store)Content copied to clipboard
Every member is safe to call from any thread.