AndroidDev, Android App Development, Android, Jetpack, Jetpack Compose.
Compose. LaunchedEffect is used to execute a suspend function snackbarHostState.showSnackbar("message") only when networkStatus is in Disconnected state. LaunchedEffect launches coroutine within the scope of the composable where it is being used and cancels it when it leaves the composition so we