I'm using a button that displays a prompt in a snackbar. Right now if I press the button rapidly, say 50 times, the snackbar appears for a few seconds, then again, and then again, till it's shown 50 times. How can I prevent this?
Here's my code-
actions: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: RaisedButton(
elevation: 7,
color: Colors.black26,
child: Text('Button'),
onPressed: () {
_scaffoldKey.currentState
.showSnackBar(SnackBar(content: Text("Welcome")));
},
),
),
],