andylamax
06/30/2020, 1:10 AMLeland Richardson [G]
06/30/2020, 1:17 AMval ambientFoo = ambientOf<Foo> { DefaultFoo }
@Composable fun Root() {
// provider
Providers(ambientFoo provides myFoo) {
App()
}
}
@Compoable fun Leaf() {
// consumer
val foo = ambientFoo.current
}
Leland Richardson [G]
06/30/2020, 1:18 AMandylamax
06/30/2020, 1:46 AMmon
06/30/2020, 3:02 AMLeland Richardson [G]
06/30/2020, 3:44 AMmutableStateOf
gives you a way to sideways-data-load into composables values that don’t change per specific sub-hierarchies of a composition, which is the problem that ambients are attempting to solveyurii.tsap
10/31/2020, 11:55 AM