I tried to search for the answer but couldn't find...
# compose
v
I tried to search for the answer but couldn't find it. How can I run some method every time I enter the screen for one time?
b
LaunchedEffect ir DisposableEffect sound like a good fit, assuming you want something executed each time a composable enters a composition.
a
I understood they meant one time and one time only, despite recompositions
b
And that's what those two effects do. They're not tied to recompositions, but rather their keys. So providing a constant key like Unit would achieve a desired effect.
v
So assuming I pass there Unit or any immutable value, it will work only once when I enter/get back to that screen?
b
When your composable enters a composition. Not sure if it's the same as opening a screen