_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text('You dont have enough money'),
));
When I give it time it does not work as well. Can it be because I am calling it from a function?
SnackBar has a property duration , use to duration property to set time till you want to show sSnackBar after tha it will disappear automatically.
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text('You dont have enough money'),
duration: Duration(seconds: 2),
));