Desk.kt
  1. 1data class DeskState(val load: Load<Lesson>)
  2. 2
  3. 3sealed interface DeskEvent {
  4. 4 data class Open(val id: String) : DeskEvent
  5. 5}

Desk.kt

State, events, and one direction

A small app still has a direction. User events go in. State comes out. The composable does not reach into a database. The repository does not know about Text().

A ViewModel holds the screen’s Load value and exposes it as a StateFlow. The UI collects it. A click calls onEvent. That split is the whole architecture this desk asks a first app to keep.

Modules can wait. A single module with packages for ui, domain, and data is enough until the lesson is actually large.

Danville · educational · 2018AboutDeskFAQOffice