qlevar_router icon indicating copy to clipboard operation
qlevar_router copied to clipboard

Force refresh issue when using alongside canPopFunc

Open arindammitra06 opened this issue 1 year ago • 0 comments

Hi There, Thanks for the awesome package. It makes our life much easier. I am currently facing a issue with navigation. My homepage route is at "/" and I have added back button check using canPopFunc() like below.

`QRoute( name: homePage,

      path: '/',
      builder: () => HomePage(),
      middleware: [
        QMiddlewareBuilder(
          redirectGuardFunc: (s) async {
            SharedPreferences prefs = await SharedPreferences.getInstance();
            int? initScreen = await prefs.getInt("initScreen");
            return initScreen == null ?  '/onboarding' : null;
          },

          canPopFunc: () async {
            AlertDialog dialog(BuildContext context) => ......//some code here
            final result = await showDialog<bool>(
                context: QR.context!, builder: dialog);
            return result ?? false;
          },
        )
      ],
      ),`

Now whenever I am trying to force refresh the page or probably do pushReplacement using QR.navigator.replaceLast('/'); the exit alert dialog in being triggered. Any way to stop this?

arindammitra06 avatar Mar 16 '23 13:03 arindammitra06