skip to Main Content

I was reviewing a code and happened to see a PopScope widget, which doesn’t have a onPopeInvoked argument called. Can someone explain what is it for?

PopScope widget in the code, and not getting the expected outcome in the web output.

2

Answers


  1. The PopScope widget you’re referring to might be a custom or third-party widget please share the code to understand it more clear

    Thank you

    Login or Signup to reply.
    1. The PopScope widget Manages system back gestures.
    2. The canPop parameter can be used to disable system back gestures.
      Defaults to true, meaning that back gestures happen as usual.
    3. When you can hide back gestures from device back button this time
      also use.
    4. This widget is useful when you want to customize the behavior of the
      back button within your Flutter app, such as confirming an action
      before navigating back or preventing the user from leaving a
      particular screen.

    Refer below small example:

    PopScope(
      onPopInvoked: (canPop) async {},
      canPop: false,
    ),
    

    Refer PopScope

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