val state by viewModel.orderDetailsLiveData.asFlow().collectAsState(
initial = null,
context = viewLifecycleOwner.lifecycleScope.coroutineContext,
)
To collect the state properly when i'm using fragments + compose ?
When should someone be using
context
param ?
i
Ian Lake
03/19/2024, 6:37 PM
It has a default because you usually don't need to change it. It is rare that it matters what context you collect on
p
prudhvi reddy
03/19/2024, 6:51 PM
🙇 Thanks for the reply
Can you think of a case where i might want to collect it in a different context ?
I can see this code after going down a bit.
Was thinking when will someone be passing a different context