In my view model I have:
var uri = savedStateHandle.getStateFlow("uri", Uri.EMPTY)
private set
In my view:
val uri by viewModel.uri.collectAsState()
Image(
painter = rememberAsyncImagePainter(
ImageRequest
.Builder(LocalContext.current)
.data(data = uri)
.build()
),
contentDescription = "",
modifier = Modifier
.padding(vertical = 16.dp)
.size(avatarSize.value)
.clip(CircleShape)
,
contentScale = ContentScale.Crop
)
When I am saving new image it is saved with the same uri in local strage so my Image is not recomposed and old one is presented. I can change uri and then image is recomposed as intended but how to inform my Image that it should be recomposed even when uri is still the same?