I am new to flutter so I am not able to find the solution of my problem. I hope to find solution here. When I am clicking back to back then all the snackbar are showing and I have to wait till the last snackbar, but I want only last clicked resulted snackbar should be shown
Asked
Active
Viewed 968 times
2 Answers
0
you can use following code to hide snackbar :
scaffoldKey.currentState.hideCurrentSnackBar(mySnackBar);

Jay Dangar
- 3,271
- 1
- 16
- 35
-
is mySnackBar of last tapped ?? – khushbu Apr 26 '21 at 08:23
-
it's the logic by which you need to maintain, this code just shows you how to hide/close the snackbar. – Jay Dangar Apr 26 '21 at 08:25
0
You can set a duration to your snackbar. In this way it will automatically get dismissed.
HomeScreen.scaffoldKey.currentState.showSnackBar(
SnackBar(duration: const Duration(minutes: 5), content: Text(message)));

Ujjwal Raijada
- 867
- 10
- 21
-
after setting duration it's not dismissing the snackbars that comes in between of first and last tapped – khushbu Apr 26 '21 at 08:24