UiText

sealed interface UiText

Platform-agnostic text holder so ViewModel state/effects never carry raw, pre-resolved strings — the UI edge resolves a UiText to an actual String (via stringResource / moko-resources for Res, or directly for Dynamic). Domain/data layers stay locale-free.

  • Dynamic wraps a literal, runtime-built string.

  • Res names a string-resource key (with optional args) resolved at the UI edge. Without a shared resource table in commonMain, asString falls back to the key.

  • Empty is an explicit "no text" so a caller never has to reach for Dynamic("").

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Dynamic(val value: String) : UiText
Link copied to clipboard
data object Empty : UiText
Link copied to clipboard
data class Res(val key: String, val args: List<String> = emptyList()) : UiText

Functions

Link copied to clipboard

Best-effort resolution with no resource table: Dynamic → its value, Res → its key, Empty → "".