Nemanja Scepanovic
12/02/2020, 2:29 PM.flowOn is set on the flow object created from the asFlow() call on the liveData object. Now, this is just a simple test, but I am wondering why is everything working as it should when this flowOn is excluded and not when this this specific flowOn is provided? Am i missing something when it comes to liveData’s asFlow() method? Cheers! :)
Sample code:
val mutableLiveData = MutableLiveData<String>("test")
runBlocking {
val item = mutableLiveData.asFlow()
.map {
Log.e("Test", "mapping $it")
return@map it
}
.flowOn(Dispatchers.Default) // problematic thingy
.first()
Log.e("Test", item)
}