Filippo De Pretto
03/23/2025, 12:31 AMmarlonlom
03/23/2025, 12:42 AMFilippo De Pretto
03/23/2025, 12:45 AMKim
03/24/2025, 3:03 AMjoaquin vidal
04/01/2025, 5:23 PMCompositionLocalProvider
, I think this is a good use case for the snackbar callback for example.
This way you wrap the app in the provider and you can call the showSnackbar
anywhere without having to pass it down to every composable explicitly.
Another option could be to have a shared viewmodel and handling there the snackbar with a state flow.galex
04/05/2025, 8:38 AMhandleEvent
aka the MVI pattern, and transform each function and its parameters into a type:
sealed interface FeedUIEvent {
data object OnNotificationsClicked,
// etc.
}
And in the VM:
fun handleEvent(event: FeedUIEvent) { .. }
Then your @Composable
is looking better:
FeedScreen(
uiState = uiState,
handleEvent: viewModel::handleEvent,
)