How do I send the green string from the HomePage page to the ContaPage page?
I think it\'s so Navigator.of(context).pushNamed(\'/conta/green\');
but I do no
Passing data from 1st Page to 2nd
In 1st page
// sending "Foo" from 1st page
Navigator.push(context, MaterialPageRoute(builder: (_) => Page2("Foo")));
In 2nd page.
class Page2 extends StatelessWidget {
final String string;
Page2(this.string); // receiving "Foo" in 2nd
}
Passing data back from 2nd Page back to 1st
In 2nd page
// sending "Bar" from 2nd
Navigator.pop(context, "Bar");
In 1st page, it is the same which was used earlier but with little modification.
// receiving "Bar" in 1st
String received = await Navigator.push(context, MaterialPageRoute(builder: (_) => Page2("Foo")));