skip to Main Content

How to fix this Constant value error

                  actions: [
                IconButton(
                   
                      icon: Icon(
                        Icons.cancel,
                        color: Colors.red,
                      ), onPressed: () { 
                        Navigator.pop(context);
                       },
                    )

              ]

Click Here

I have provided a code snippet for a Flutter application that includes an IconButton widget with an icon for the cancel button. When the button is pressed, the current screen is displayed using Navigator.pop(context) How to implement pop from navigation layer ?

2

Answers


  1. The problem is on your AlertDialog.

    You just need to remove const before AlertDialog.

    Login or Signup to reply.
  2. There will be a const before the dialog box code. Please remove it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search