asString

Resolves this UiText to a String within a Composable context.

This is the preferred method for resolving UiText in Compose UI, as it properly handles configuration changes and recomposition.

Return

The resolved string value.


fun asString(context: Context): String

Resolves this UiText to a String using an Android Context.

Use this method in non-Composable code such as:

  • WorkManager workers

  • Notification builders

  • Service classes

  • ViewModels (when absolutely necessary)

Note: Prefer the Composable asString() variant in UI code.

Return

The resolved string value.

Parameters

context

Android context for resolving string resources.