Hey everyone, I have a list of images that I’m saving locally, when entering the screen. I want to show them all at the same time when they are ready, in a LazyRow.
To do this, I’m using produceState, to try to download the images, and return the Files of those downloaded successfully:
val imageFiles = produceState(initialValue = emptyList<File>(), imageRefs) {
imageRefs.map { imageRef ->
async {
downloadItemImage(imageRef, file)
}
}.awaitAll().filterNotNull()
}
Then, I’d like to map this List<File> to a List<Painter>, and send it to my ImagesRow composable, like this:
val painters = imageFiles.value.map { file ->
rememberImagePainter(file)
}
ImagesRow(painters = painters)
Problem is: The painters aren’t being updated when imageFiles is updated. Any ideas?