I have a sealed class which is being sending via StateFlow. How to cast it in order to retrieve an enclosed value? I cannot find any example of syntax for databinding expressions.
dataclass UserInfo(val name: String)
sealed class ResultOf<out T> {
data class Success<out R>(val content: R): ResultOf<R>()
data class Failure(val throwable: Throwable): ResultOf<Nothing>()
}
val model = ResultOf.Success.content(UserInfo("John Doe"))
<variable
name = "viewModel"
type="com.example.hello.user.ResultOf"/>
<TextView
android:id="@+id/name"
android:text="@{ ??? }"
/>
viewModel.Success.content.name (UserInfo)viewModel.content.name (viewModel as UserInfo).content.name
None of the above works neither