Pablo
01/12/2025, 8:38 AMonClick = { onMessageDialogEvent(stringResource(Res.string.bus_stops_db_filled, successUiState.data.size)) },
But stringResource can't be called because onClick is not a composable:
@Composable invocations can only happen from the context of a @Composable function
How can this situation be solved? I need to transform that resource into a string before hoisting it, because it is stored on a app state holder which requires it on string, for some complex stuff (a lot of string resources requires a lot of parameters, and I can't hoist all those multiple parameters, it's easy to simply hoist the string)calidion
01/12/2025, 8:50 AMval str = stringResource(Res.string.bus_stops_db_filled) Button(onClick = { onMessage(str) })
Pablo
01/12/2025, 9:00 AMPablo
01/12/2025, 9:01 AMPablo
01/12/2025, 9:01 AMcalidion
01/12/2025, 9:31 AMcalidion
01/12/2025, 9:32 AMZach Klippenstein (he/him) [MOD]
01/12/2025, 2:21 PMLocalContext
in composition instead then pull the string resource out of the context’s resources in the callback.Sanlorng
01/14/2025, 11:05 PMsuspend fun getString(res: StringRes): String
function that is suitable for non composable function.