getX router back navigation

Viewed 37

I'm using GetX package and I want to close and remove one dialog on my page. Actually, I don't want to remove the snack bar or other things. I just want to remove and close one special dialog. Is there any way to do that?

This is my dialog with GetX package:

Get.dialog(
      Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: const [
          Center(
            child: Padding(
              padding: EdgeInsets.all(50.0),
              child: Center(
                child: Loading(),
              ),
            ),
          ),
        ],
      ),
      barrierDismissible: false,
    ),

And this is to remove my dialog:

  Get.back();
1 Answers

You can use

if(Get.isDialogOpen){
Get.back();
}
else{
//whatever you want.
}

By using this you can close the dialog only without closing other widgets like snackbar our your route/widget.

Related