electrolobzik
01/09/2024, 7:50 PMval faceConditionsChecker by remember {
mutableStateOf(
FaceConditionsChecker {
faceFrameRect
}
)
}
Where faceFrameRect is a parameter of the composable function. I pass it via lambda to the class FaceConditionsChecker using it as val frameProvider: () -> RectF. Will the value of faceFrameRect when the lambda is called always correspond to the actual value of the parameter faceFrameRect ? If not how could I recreate FaceConditionsChecker on parameter change?MR3Y
01/09/2024, 8:58 PMremember has no way to know that your function recomposed with a different faceFrameRect value to re-execute the lambda body. to fix this add faceFrameRect as a key to rememberZach Klippenstein (he/him) [MOD]
01/09/2024, 8:59 PMelectrolobzik
01/10/2024, 8:54 AMkey parameter or the remember . And it really makes sense to refactor this, because actually FaceConditionsChecker is stateless and I can replace it by a static function.