-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Support MaterialApp.router() which doesn't have a navigatorKey argument, as well as MaterialApp() #197
Comments
The issue occurs with DialogReportMode. Using SilentReportMode instead seems to resolve it. |
@buzzware Navigator key has been used for 1.0 routing. I didn't use 2.0 yet because level of complexity (there's even package created by one of flutter team members to handle this complexity). Can you provide some minimal reproducible example? It could be just small two screens app. |
@jhomlala I agree that the 2.0 routing is a mess from Flutters side, at least earlier this year when I implemented it in our app. This is a pretty good article and there are some others too: https://johnwcassidy.medium.com/building-a-simple-stack-navigator-with-flutter-navigation-2-0-f11b55b71520 I'm using catcher with navigator 2.0 by adding the Catcher.navigatorKey to the "Navigator" widget, like this: And then I set it in the Navigator class like this:
I'm just adding catcher to this project but it seems to work very nicely. @buzzware see above if you haven't found a workaround yet. |
I think that the larger issue here is some routing libraries are managing their own navigator keys. I think this can be mitigated by either the navigator libraries allowing us to provide a Key Just through a quick skim, |
@ibrahim-mubarak So is there another way to set the value for |
For Go Router in your GoRouter constructor you can set a navigationKey so that is the place to put the Catcher.naviationKey as far as I know |
Is your feature request related to a problem? Please describe.
Your documentation says to include navigatorKey: Catcher.navigatorKey when calling MaterialApp().
Navigator 2.0 uses MaterialApp.router instead, which doesn't have a navigatorKey parameter,
and then I get the error "Couldn't use report mode because you didn't provide navigator key. Add navigator key to use this report mode."
Describe the solution you'd like
I don't know enough about keys or this library to suggest a solution
Describe alternatives you've considered
Maybe create my own version of MaterialApp.router ?
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: