this is code from 2 classes merged here into one code block?
Frank van der Laan
07/12/2022, 9:53 AM
"nothing will change", maybe connect your debugger and see what part of the code is not reached.
t
Tong Zhang
07/12/2022, 9:55 AM
yes ,merged core code from a
ViewModel
and an
Activity
Tong Zhang
07/12/2022, 10:01 AM
I just don't understand why I can't receive the content sent by
stateFlow
when I rotate the screen and then click the button.
f
Frank van der Laan
07/12/2022, 2:48 PM
I don't see anything strange here. Are you sure only one VM is created?
g
Gibson Ruitiari
07/14/2022, 8:58 PM
maybe try to remove the withContext(Dispatchers.Main) block, by default repeatOnLifecycle does its work on the main Dispatcher so I don't think it is needed