Micko Cabacungan
04/06/2022, 6:52 PMcollectAsState
but if I do that for a SharedFlow, it will remember the last value, instead of firing and forgetChris Fillmore
04/06/2022, 6:54 PMMicko Cabacungan
04/06/2022, 6:55 PMChris Fillmore
04/06/2022, 6:59 PMMicko Cabacungan
04/06/2022, 7:02 PMTobias Gronbach
04/06/2022, 11:23 PM@Composable
fun <T> Flow<T>.collectAsEffect(
context: CoroutineContext = EmptyCoroutineContext,
block: (T) -> Unit,
) {
LaunchedEffect(key1 = Unit) {
onEach(block).flowOn(context).launchIn(this)
}
}
Micko Cabacungan
04/06/2022, 11:46 PM