2

in my app, I have a screen called Tickets with route '/Tickets'. And it can be navigated to from 2 other screens. In one of the screens, I passed an object "isFromPage":true as an argument.

Now, in my Tickets widget, I want to get that attribute and render a component if it is found.

In my Page Widget/Screen:

Navigator.of(context).pushNamedAndRemoveUntil(
  '/Tickets',
  (route) => false,
  arguments: { 
    "isFromPage": true
  }
);

What I want to do in my Tickets Page:

@override
Widget build(BuildContext context) {
  return new Scaffold(
    body: Column(
      children: <Widget>[
        Text("Tickets Page"),    
        (isFromPage) // Heres where I want to use the argument
        ? RaisedButton(child: Text("Back"))
        : Text("")
      ]
    )
  );
}

NOTE: I don't want to change my Navigator to a MaterialPageRoute(...) or something, I have to use a named route

Kingsley CA
  • 10,685
  • 10
  • 26
  • 39

0 Answers0