in flow from kotlin there is a method called stateIn to convert flow to stateFlow . signature of the method asks for Coroutine scope . what exactly i need to pass as scope ?
d
Dominaezzz
03/05/2021, 11:10 AM
You need to pass a scope that covers the lifetime of the
stateIn
collection. You could pass in a
viewModelScope
.
a
Anshulupadhyay03
03/08/2021, 7:17 AM
@Dominaezzz thanks but the problem is that the repository classes i have are part of domain module which is a pure java module hence i can not have a reference of viewmodelscope there. In this case i am assuming that the conversion has to be done on the android module side or is there any other option ?