Has anyone used `Snackbar`? I found 2 methods on d...
# compose
v
Has anyone used
Snackbar
? I found 2 methods on docs, 1 is taking
boolean state
and making it
visible/hide
on button click but here Snackbar doesn't get disappear after some interval (as we are controlling through state). 2 is when using
Scaffold
, it has
snackbarHost
where we customize our snackbar and display using a
Coroutine Scope
. So how can we make Snackbar hide after some time in 1 method? or should we use 2 method
a
SnackBarHost takes care of that for you
Wrap your SnackBar with SnackBarHost and take the snackbarHostState so you can trigger a snackbar
Scaffold makes that easier for you as it just passes you the snackbarHostState for you to use