jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.39k stars 1.63k forks source link

Route Management #3225

Open sheri-dal opened 1 month ago

sheri-dal commented 1 month ago

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION. Fill in the template. Issues that do not respect the model will be closed.

Describe the bug I can use redirectDelegate override method but not work and not reflect in Get.toName(Routes, Argument). any other solution to use async method in use in redirec middelware?

**Reproduction code @override Future<GetNavConfig?> redirectDelegate(GetNavConfig route) async { // Simulate an async operation, such as checking a token or API call var value = await checkUserAccess(); if (!value) { var currentRoute = Get.currentRoute; Helper.errorMsg("You are not authorized to access this page.", "", null); return GetNavConfig.fromRoute(currentRoute); } else
{ // If not authenticated, redirect to login page // Get.toNamed(route.location); return super.redirectDelegate(route); } }

Flutter Version: lateest

Getx Version: 4.6.6