0

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

DON DAN
  • 57
  • 1
  • 1
  • 5
khushbu
  • 47
  • 4

2 Answers2

0

you can use following code to hide snackbar :

scaffoldKey.currentState.hideCurrentSnackBar(mySnackBar);

Jay Dangar
  • 3,271
  • 1
  • 16
  • 35
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