-
Notifications
You must be signed in to change notification settings - Fork 273
Description
Project Name
flutter_modular
Route Guard prevents redirection when the pathName is obtained asynchronously, because redirectTo is only defined in the constructor method:
Describe the solution you'd like
A suggestion would be, to maintain backward compatibility and avoid break changes, to keep redirectTo in the constructor method, but also create a setter that would allow changing the constructor value if it initializes as null
Additional context
Consider the hypothetical situation that, if the user is logged in and tries to force a route via the URL that they do not have access to, they should go to one screen, and if they are logged out, they should go to another. User data can be retrieved synchronously in the singleton, but when the user reloads the page, they lose this data and it needs to be retrieved again asynchronously from LocalStorage.
Because of this, it's not possible to set the route directly in the constructor method, currently forcing the developer to use a less-than-ideal solution: forcing redirection instead of using what the documentation specifies (RouteGuard's redirectTo)
I would like to work on this adjustment?
Yes, I would like to