Hello everyone! I was wondering if anyone has enco...
# coroutines
n
Hello everyone! I was wondering if anyone has encountered the following: Basically, nothing gets printed when
.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:
Copy 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)
        }