Flutter Navigation: Fetching the previous Route
up vote
0
down vote
favorite
I have been doing some flutter development lately out of interests and I came upon the flutter navigator. I am using the default style way, so no routing lib is used(just Navigator.push/pop), however I would like to be able to fetch the previous route of the current rout(in other words fetching the route that initialised and called the current one.
At the moment I have a final field in each Route where I can recognise the caller, however this is a very bad way of doing it in addition of being unpractical especially when I have composed classes.
Any idea of how this can be achieved? Thanks
|
show 1 more comment
up vote
0
down vote
favorite
I have been doing some flutter development lately out of interests and I came upon the flutter navigator. I am using the default style way, so no routing lib is used(just Navigator.push/pop), however I would like to be able to fetch the previous route of the current rout(in other words fetching the route that initialised and called the current one.
At the moment I have a final field in each Route where I can recognise the caller, however this is a very bad way of doing it in addition of being unpractical especially when I have composed classes.
Any idea of how this can be achieved? Thanks
so you want to get he parent's Route object?
– pskink
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have been doing some flutter development lately out of interests and I came upon the flutter navigator. I am using the default style way, so no routing lib is used(just Navigator.push/pop), however I would like to be able to fetch the previous route of the current rout(in other words fetching the route that initialised and called the current one.
At the moment I have a final field in each Route where I can recognise the caller, however this is a very bad way of doing it in addition of being unpractical especially when I have composed classes.
Any idea of how this can be achieved? Thanks
I have been doing some flutter development lately out of interests and I came upon the flutter navigator. I am using the default style way, so no routing lib is used(just Navigator.push/pop), however I would like to be able to fetch the previous route of the current rout(in other words fetching the route that initialised and called the current one.
At the moment I have a final field in each Route where I can recognise the caller, however this is a very bad way of doing it in addition of being unpractical especially when I have composed classes.
Any idea of how this can be achieved? Thanks
asked 2 days ago
mquemazz
1851311
1851311
so you want to get he parent's Route object?
– pskink
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago
|
show 1 more comment
so you want to get he parent's Route object?
– pskink
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago
so you want to get he parent's Route object?
– pskink
2 days ago
so you want to get he parent's Route object?
– pskink
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203543%2fflutter-navigation-fetching-the-previous-route%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
so you want to get he parent's Route object?
– pskink
2 days ago
If you mean by parent, the class that has called or navigated to the new route, then yes I would like to get it. The reason why I am asking this, I have a generic screen that can be used in different situations during the life cycle of the app. Based on the caller of this screen, it has to call other screens.
– mquemazz
2 days ago
what about adding your own listener to observers property?
– pskink
2 days ago
or maybe docs.flutter.io/flutter/widgets/RouteAware-class.html (i have no idea how to use it though, as i "found" it 30 seconds ago...)?
– pskink
2 days ago
I am actually reading about it, I never used it either and didn't have the need for it. The interesting part is, there is an open ticket in the Flutter Repo, regarding something similar.
– mquemazz
2 days ago