steelahhh
02/03/2022, 8:48 AMLaunchedEffect
for all of them vs one LaunchedEffect
per flow
See 🧵 for exampleLaunchedEffect(Unit) {
someflow
.onEach { /* ... */ }
.launchIn(this)
someflow1
.onEach { /* ... */ }
.launchIn(this)
someflow2
.onEach { /* ... */ }
.launchIn(this)
}
// OR
LaunchedEffect(Unit) {
someflow
.onEach { /* ... */ }
.launchIn(this)
}
LaunchedEffect(Unit) {
someflow1
.onEach { /* ... */ }
.launchIn(this)
}
LaunchedEffect(Unit) {
someflow2
.onEach { /* ... */ }
.launchIn(this)
}
Big Chungus
02/03/2022, 8:54 AMsteelahhh
02/03/2022, 8:56 AMZoltan Demant
02/03/2022, 9:12 AMlaunch{}
inside the LaunchedEffect to collect multiple flows though, but I dont know how that differs from just using multiple LaunchedEffects!myanmarking
02/03/2022, 9:18 AMZoltan Demant
02/03/2022, 9:30 AMlaunch { flow.collect }
👍🏽myanmarking
02/03/2022, 9:30 AMStylianos Gakis
02/03/2022, 12:27 PMlaunchedIn
mentioned here, I feel the obligation to link this https://www.billjings.com/posts/title/avoid-launchin/?up=technical . I really liked it as an idea and I think that it has helped me make some of my code nicer. I still use it myself too, but a tiny bit less.Arjun Achatz
02/03/2022, 1:33 PMmyanmarking
02/03/2022, 2:18 PMStylianos Gakis
02/03/2022, 2:24 PMAdam Powell
02/03/2022, 2:55 PM