I’ve implemented an app on Flutter framework. I’m new to flutter and I don’t know how to pass the data to new screen. Someone said me that you should use Named routes in your app so I tried it. But now I don’t know how to pass the data from one screen to another screen.
These are the routes in my MaterialApp:
routes: {
'/': (context) => FirstPage(),
'/second': (context) => SecondPage(),
'/third': (context) => ThirdPage(),
},
And this is how I navigate to new screen normally:
onPressed: () {
Navigator.pushNamed(context, '/second');
},
I want to pass the data to new screen when navigate to new screen.
New contributor
Nil Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.