Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show a snackbar after navigator.pop(context) in Flutter?

Tags:

We need close one screen and open a second screen. And show snackbar on the second screen from first screen.

I tried to use Navigator.push, but this screen is already open and we have this error

Bad state: Stream has already been listened to.

like image 973
Emily Harkness Avatar asked Jul 10 '18 08:07

Emily Harkness


People also ask

How do you show SnackBar in flutter without scaffolding?

you probably have a parent widget that contains Scaffold as well. Create a scaffoldKey for that and pass it to your child widget that have to show the Snakcbar . Note that you can't use Sanckbar without Scaffold widget.

How do you show SnackBar on top in flutter?

top-snackbar-flutter If you need to show the user some information in a nice way, you can use this package. The API is as simple as API for regular Material method showDialog . If you need to use your own widget to display, you can pass it into showTopSnackBar function.


1 Answers

Instead of Snackbar i would suggest you to use Flushbar plugin for flutter it is easy to use and it'll take care of everything and u can customize it to a great extent . Snackbar needs a scaffold ancestor to work but Flushbar doesn't and it takes care of all the extra stuff itself and provides with ton of cool features.

Flushbar Plugin here

like image 102
Aman Malhotra Avatar answered Sep 29 '22 01:09

Aman Malhotra