<Activity restart when configuration changes but I...
# stackoverflow
u
Activity restart when configuration changes but I used viewmodel Viewmodel class using hilt viewmodel and avoids configuration changes side effects @HiltViewModel class ListScreenModel @Inject constructor():ViewModel() { val myFlow=flow{ (0..100).forEach{ emit(it) kotlinx.coroutines.delay(1000) } } } Composable function where I use my viewmodel and try to print emitted values. @Composable fun ListValue() { val viewmodel = hiltViewModel() val num=viewmodel.myFlow.collectAsState(initial = 0).value Text( text =...