Reputation: 367
This is the scenario
Upvotes: 1
Views: 4920
Reputation: 5060
From my knowledge, I think unlike BLoC there's nothing like BlocListener
or BlocConsumer
in GetX. But you can use RxWorker
to achieve this like:
ever(someObservable, (){
doSomething(); // show dialog, snackbar, navigate to other pages
}
Just remember you need to put this before the return
of your build
method.
Upvotes: 3
Reputation: 1172
You can use below code for show snackbar in flutter
Get.snackbar(
"Hello",
"Thank You!",
snackPosition: SnackPosition.TOP,
colorText: Colors.white,
borderRadius: 10,
backgroundColor: AppColors.toastGreenColor ,
icon: Image.asset(
"assets/images/success_toast.png",
height: 25,
width: 25,
color: Colors.white,
),
);
Upvotes: 0