DynamicShortcutEffect

fun DynamicShortcutEffect(id: String, vararg keys: Any?, removeOnDispose: Boolean = true, builder: ShortcutSpec.() -> Unit)

Publishes a dynamic shortcut while this composable is in composition.

The shortcut is published (or updated in place) when the effect enters composition and whenever id or any of keys changes — pass as keys whatever state the builder reads, mirroring the androidx.compose.runtime.LaunchedEffect idiom. When the effect leaves composition the shortcut is removed if removeOnDispose is true (the default); pass false for shortcuts that should outlive the screen.

DynamicShortcutEffect("compose_email", draftCount) {
shortLabel = "Compose ($draftCount drafts)"
icon = R.drawable.ic_compose
intent { target<ComposeActivity>() }
}