https://kotlinlang.org logo
#codingconventions
Title
# codingconventions
m

Michal Klimczak

09/07/2023, 10:11 AM
I got no answers on the compose channel, figured that maybe here I will have more luck and it seems to fit the theme. https://kotlinlang.slack.com/archives/CJLTWPH7S/p1693389803639179
p

Pablichjenkov

09/07/2023, 7:20 PM
I prefer
1
, not quite exactly like the above code but some composable that remembers a State. The magic happens inside the State. I would place its own coroutine and expose StateSnapshots or StateFlows in case is needed to refresh the composable UI
But it is up to the requirements. If you don't need to keep track of the State or in other words having State history. Then 2 works, one single shot, that's it. Is just that most of the time I use 1 method