Flutter get navigator param in page
up vote
1
down vote
favorite
I have 2 pages PAGE A and PAGE B. I navigate form PAGE A -> PAGE B and do edit some data, or toggle a setting. Now I want to navigate form PAGE B -> PAGE A and also what that a parameter would be send on navigator pop method. Now my question:
How I can access to these parameter in PAGE A?
Navigator.pop(context, this.selectedEquipmentId);
dart flutter
add a comment |
up vote
1
down vote
favorite
I have 2 pages PAGE A and PAGE B. I navigate form PAGE A -> PAGE B and do edit some data, or toggle a setting. Now I want to navigate form PAGE B -> PAGE A and also what that a parameter would be send on navigator pop method. Now my question:
How I can access to these parameter in PAGE A?
Navigator.pop(context, this.selectedEquipmentId);
dart flutter
see whatNavigator#push()
method returns
– pskink
Nov 11 at 12:21
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
1
because it is a Future
– pskink
Nov 11 at 13:33
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have 2 pages PAGE A and PAGE B. I navigate form PAGE A -> PAGE B and do edit some data, or toggle a setting. Now I want to navigate form PAGE B -> PAGE A and also what that a parameter would be send on navigator pop method. Now my question:
How I can access to these parameter in PAGE A?
Navigator.pop(context, this.selectedEquipmentId);
dart flutter
I have 2 pages PAGE A and PAGE B. I navigate form PAGE A -> PAGE B and do edit some data, or toggle a setting. Now I want to navigate form PAGE B -> PAGE A and also what that a parameter would be send on navigator pop method. Now my question:
How I can access to these parameter in PAGE A?
Navigator.pop(context, this.selectedEquipmentId);
dart flutter
dart flutter
asked Nov 11 at 9:03
abuder
429820
429820
see whatNavigator#push()
method returns
– pskink
Nov 11 at 12:21
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
1
because it is a Future
– pskink
Nov 11 at 13:33
add a comment |
see whatNavigator#push()
method returns
– pskink
Nov 11 at 12:21
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
1
because it is a Future
– pskink
Nov 11 at 13:33
see what
Navigator#push()
method returns– pskink
Nov 11 at 12:21
see what
Navigator#push()
method returns– pskink
Nov 11 at 12:21
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
1
1
because it is a Future
– pskink
Nov 11 at 13:33
because it is a Future
– pskink
Nov 11 at 13:33
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
In fact you got to return something when you ends PageA. I put you an exemple with a popup to select an adress i made recently, this work exactly the same if this is not a popup.
Future<PlacesDetailsResponse> showAdressPicker(@required BuildContext context) async
assert(context != null);
return await showDialog<PlacesDetailsResponse>(
context: context,
builder: (BuildContext context) => AdressPickerComponent(),
);
You can send a result from Navigator.pop(...) and get it from PageA
Navigator.pop(context, result)
Just put anything you want in result, (here i created a class named PlacesDetailsResponse, use yours or just Int, String...).
Now In pageA when you call this
showAdressPicker(context: context).then((PlacesDetailsResponse value)
//do whatever you want here
// this fires when PageB call previous to PageA
);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
In fact you got to return something when you ends PageA. I put you an exemple with a popup to select an adress i made recently, this work exactly the same if this is not a popup.
Future<PlacesDetailsResponse> showAdressPicker(@required BuildContext context) async
assert(context != null);
return await showDialog<PlacesDetailsResponse>(
context: context,
builder: (BuildContext context) => AdressPickerComponent(),
);
You can send a result from Navigator.pop(...) and get it from PageA
Navigator.pop(context, result)
Just put anything you want in result, (here i created a class named PlacesDetailsResponse, use yours or just Int, String...).
Now In pageA when you call this
showAdressPicker(context: context).then((PlacesDetailsResponse value)
//do whatever you want here
// this fires when PageB call previous to PageA
);
add a comment |
up vote
1
down vote
In fact you got to return something when you ends PageA. I put you an exemple with a popup to select an adress i made recently, this work exactly the same if this is not a popup.
Future<PlacesDetailsResponse> showAdressPicker(@required BuildContext context) async
assert(context != null);
return await showDialog<PlacesDetailsResponse>(
context: context,
builder: (BuildContext context) => AdressPickerComponent(),
);
You can send a result from Navigator.pop(...) and get it from PageA
Navigator.pop(context, result)
Just put anything you want in result, (here i created a class named PlacesDetailsResponse, use yours or just Int, String...).
Now In pageA when you call this
showAdressPicker(context: context).then((PlacesDetailsResponse value)
//do whatever you want here
// this fires when PageB call previous to PageA
);
add a comment |
up vote
1
down vote
up vote
1
down vote
In fact you got to return something when you ends PageA. I put you an exemple with a popup to select an adress i made recently, this work exactly the same if this is not a popup.
Future<PlacesDetailsResponse> showAdressPicker(@required BuildContext context) async
assert(context != null);
return await showDialog<PlacesDetailsResponse>(
context: context,
builder: (BuildContext context) => AdressPickerComponent(),
);
You can send a result from Navigator.pop(...) and get it from PageA
Navigator.pop(context, result)
Just put anything you want in result, (here i created a class named PlacesDetailsResponse, use yours or just Int, String...).
Now In pageA when you call this
showAdressPicker(context: context).then((PlacesDetailsResponse value)
//do whatever you want here
// this fires when PageB call previous to PageA
);
In fact you got to return something when you ends PageA. I put you an exemple with a popup to select an adress i made recently, this work exactly the same if this is not a popup.
Future<PlacesDetailsResponse> showAdressPicker(@required BuildContext context) async
assert(context != null);
return await showDialog<PlacesDetailsResponse>(
context: context,
builder: (BuildContext context) => AdressPickerComponent(),
);
You can send a result from Navigator.pop(...) and get it from PageA
Navigator.pop(context, result)
Just put anything you want in result, (here i created a class named PlacesDetailsResponse, use yours or just Int, String...).
Now In pageA when you call this
showAdressPicker(context: context).then((PlacesDetailsResponse value)
//do whatever you want here
// this fires when PageB call previous to PageA
);
answered Nov 11 at 13:44
mcfly
298211
298211
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247236%2fflutter-get-navigator-param-in-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
see what
Navigator#push()
method returns– pskink
Nov 11 at 12:21
I tried this, but is not working: this.selectedEquipmentId = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) return ExercisesFilterPage( equipments: equipments, ); , ), ) as String;
– abuder
Nov 11 at 13:32
1
because it is a Future
– pskink
Nov 11 at 13:33