You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using stateIn operator inside ScreenModelusing built-in coroutineScope cause a crash with java.lang.IllegalStateException: ScreenModel not found. However, this exception doesn't happen if self-created Coroutine scope is used.
Example code,
class TestScreen : Screen {
@Composable
override fun Content() {
val sm = rememberScreenModel { TestScreenModel() }
val msg by sm.msg.collectAsState()
Text(msg)
}
}
class TestScreenModel : ScreenModel {
val msg = msgFlow.stateIn(coroutineScope, SharingStarted.Lazily, "")
}
val msgFlow = listOf("Hello", "world!").asFlow()
The text was updated successfully, but these errors were encountered:
Using
stateIn
operator insideScreenModel
using built-in coroutineScope cause a crash withjava.lang.IllegalStateException: ScreenModel not found
. However, this exception doesn't happen if self-created Coroutine scope is used.Example code,
The text was updated successfully, but these errors were encountered: