events
One-shot UI event stream.
Events are buffered and delivered in order. Each emission is consumed once, making this suitable for side-effects such as:
Snackbar messages
Toast notifications
Dialog triggers
Navigation (via Destination)
Collect this inside KScreen or a LaunchedEffect:
LaunchedEffect(viewModel) {
viewModel.events.collect { event ->
when (event) {
is ProfileEvent.ShowToast -> { ... }
else -> Unit
}
}
}Content copied to clipboard
Note: Because events are typed as Any,
whenexpressions require anelsebranch. Prefer dev.kindling.compose.KViewModel (two-param) if exhaustive event handling matters for your screen.