SnackbarHostState

@Stable
class SnackbarHostState

State of the SnackbarHost, which controls the queue and the current Snackbar being shown inside the SnackbarHost.

This state is usually remembered and used to provide a SnackbarHost to a Scaffold.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

The current SnackbarData being shown by the SnackbarHost, or null if none.

Functions

Link copied to clipboard
suspend fun showSnackbar(message: String, actionLabel: String? = null, withDismissAction: Boolean = false, duration: SnackbarDuration = if (actionLabel == null) SnackbarDuration.Short else SnackbarDuration.Indefinite): SnackbarResult

Shows or queues to be shown a Snackbar at the bottom of the Scaffold to which this state is attached and suspends until the snackbar has disappeared.