Whats the best way to call remember inside a corou...
# compose
a
Whats the best way to call remember inside a coroutineScope? I want to asynchronously load an image into a view but remember it if the key hasn't changed..
z
You can’t.
remember
is a thing that is only necessary in a composable because of how composable functions work.
You can just use a regular property or variable scoped appropriately, like you would without compose, for coroutines code
a
okay thanks for the quick reply, i ended up with a mutableStateOf + remember and a LaunchedEffect to actually update the state
is this okayish?
z
That sounds pretty common
In fact there’s even a convenience function for that pattern:
produceState
2
a
Thats really nice, just saw it the last days on twitter somewhere but this is actually really cool