https://kotlinlang.org logo
#compose
Title
# compose
b

Bacho Kurtanidze

04/09/2020, 12:16 PM
is it safe to use
ContextAmbient.current
wherever I want in my code?
a

Adam Powell

04/09/2020, 1:46 PM
Safe in what way?
b

Bacho Kurtanidze

04/09/2020, 2:22 PM
I was concerned that it could leak context or throw some kind of exception since it was static
t

Timo Drick

04/10/2020, 5:44 PM
As far as i understood the system now: This function is a composable and can only be called inside of an other composable function. So you can not use it everywhere. And inside a composable function it should be safe.
👍 1
a

Adam Powell

04/10/2020, 6:18 PM
As long as you don't send a long-lived reference someplace else 🙂