When a composable function is invoked, the invocation might occur on a different thread from the caller. That means code that modifies variables in a composable lambda should be avoided–both because such code is not thread-safe, and because it is an impermissible side-effect of the composable lambda. -link
Parallel execution in Compose is very new to me. Could someone tell me please how I can modify variables if I am not allowed to do it in a Composable lamda? Also, what does thread-safety mean in the above paragraph?
m
manueldidonna
09/07/2020, 5:59 PM
This means that you can't make assumptions about how many times a composable will be invoked. Modify a variable is considered as a side effect of the composition and you can do it using