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

Peter Mandeljc

01/26/2023, 8:05 AM
does it make sense to use remember for annotated string?
Copy code
val text = remember {
    buildAnnotatedString {
        // ...
    }
}
s

Stylianos Gakis

01/26/2023, 9:33 AM
You can use remember on anything that you don’t want to be re-calculated on every recomposition. The difference might be minuscule though, and if you are using something inside the builder which is not set as a key to
remember
you can also get correctness problems. Not sure if the annotatedString is slow, if you really are worried maybe try and profile this somehow?
21 Views