-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#2435Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
copied from csells/go_router#184
When we use the redirect we might want to check for dependencies injected in the widget tree using the context.
For instance, I have pages that are only accessible under certain user permissions. In Flutter web a user can simply type the url path to the page they want to see (navigate) but if the permission is not present the page should redirect.
I have the permissions up in the tree as the state of a bloc (using flutter bloc) and it would be great if I could receive the context in the redirect and simply find the bloc's state.
I believe this is possible, either passing the current navigator's state's context to the redirect callback or to the GoRouterState.
This should be broken into various stage:
- 1. refactor go route match to be in the routeinformationparser [go_router] Refactor RouterDelegate into functional pieces packages#1653
- 2. change native API to pass the context to RouteInformationParser Add RouteInformationParser.parseRouteInformationWithDependencies #102414
- 3. pass the context to redirect.
ferraridamiano, combi-35, chimon2000, 0xba1, maks and 19 morecombi-35, spakanati, DamienMrtl, dleurs, kmh339 and 3 more
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.