-
-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Stacked Services] currentRoute is always empty #218
Comments
@bdairy we use get's current route functionality directly so we don't have any code around how that works in the package. We index into |
@FilledStacks I admire how you care about your product, you deserve all the support.. Main.dart file is quite big and chunked into many files,, I am using a scoped model wrapper for the whole app for localization purposes, and theme is separated.. main.dart
My App
|
Everything looks perfect. The only "outdated" code is the navigator key. There's a static property in the latest stacked_services now which you can use. navigatorKey: StackedService.navigatorKey, That shouldn't fix the problem though. We're using gets built in functionality, maybe the way we're using the routing functionality is causing the issue. I'll need to check into the get package to see when they update the currentRoute to be able to provide ay feedback. I will schedule some time later today to look at that and provide you with feedback. |
Thanks for the Update hint, I am now using the StackedService.navigatorKey.. First of all Printing the current route like this will give me the route name:
A simple nav.navigateTo(someRoute)... on the target route loads I am checking the currentRoute.. and it is empty... _navigationService.currentRoute.isEmpty always returns true. One note,,, this statement is inside a function in the builder method of the ViewModel... but the current route in Stacked Service is still empty Sooo check this out:
model.getAction method is this:
|
@bdairy that's most likely because the route has not been set by the time that function executes. You're asking for the current route before it's been built and set. Can you try and delay that call and see if current route is set then? |
@FilledStacks tried that in all possible ways, in different views and in different locations.. nothing seems to be working,, on the other hand one more thing,, I really admire your responses even though I know your busy with your tutorials.. Thanks.. |
@bdairy that's strange. Rather use the one that works then. I don't know why it's not working and I don't have any time to allocate to looking at that at the moment. Thanks for taking the time to update me about it. I appreciate it :) |
@FilledStacks thanks I already used the working one,,, I'll let you know if anything came across.. |
Also experiencing this issue |
Do you guys have any workaround for this issue? I'm trying to get the current route in some services without |
@akifarhan we're actually also experiencing this at the moment. We've had other issues with the get context as well. We will make time to look into our own abstraction for the context-less navigation and tackle all of this as well. I don't know when that'll be. we need the #195 null migration issue to be ready before making big moves. |
I am also facing this issue, ModalRoute does not work for me, so I need to write a wrapper for this |
We also ran into this, ModalRoute doesn't work for us because it's in a nested route. |
I have no idea why the functionality isn't working as expected. I'll probably have to track this manually in our navigation service and build an internal stack to keep in sync. |
Finally got around to fixing this. Here's the documentation for it. Thanks @hurbes |
This still doesn't seem to work with nested routes, e.g. MaterialRoute(page: LoginView, initial: true),
MaterialRoute(
page: DrawerNavigatorView,
children: [
CustomRoute(page: HomeView, initial: true),
CustomRoute(page: ReportsView),
CustomRoute(page: TeamView),
CustomRoute(page: SettingsView),
CustomRoute(page: SupportView),
],
), Using currentRoute when on one of the nested routes just always returns |
Hello there,
I am using the navigation service in my app..
I have a view (QR scanner view) that is accessable from 2 places..
the first place is as a startup view,,, in this case I am showing a button to take me to the dashboard..
the second place is in the dashboard... in this case I am not showing a button to take me to the dashboard, I am just using the back button.
when I access the view from the dashboard simply by calling
locator<NavigationService>().navigateTo(QRScannerRoute);
In the QRScannerView I want to check if my currentRoute is empty "which means It is the startup view" Show the link to take me to the dashboard... but if my current route is not empty which indicates I accessed it from the dashboard just use the default backButton... But in all the cases currentRoute is always empty,,, same applies to the previous route..
To summarise...
locator<NavigationService>().navigateTo(QRScannerRoute);
leads to empty currentRoute in the target view always.
also I couldn't find a way to access the navigation stack to check if it is empty or not..
The text was updated successfully, but these errors were encountered: