{"id":2005,"date":"2022-04-07T08:02:41","date_gmt":"2022-04-07T08:02:41","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=2005"},"modified":"2022-04-07T08:02:41","modified_gmt":"2022-04-07T08:02:41","slug":"create-two-routes","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/07\/create-two-routes\/","title":{"rendered":"Create two routes"},"content":{"rendered":"\n<p>Here, we are going to create two routes for navigation. In both routes, we have created only a&nbsp;<strong>single button.<\/strong>&nbsp;When we tap the button on the first page, it will navigate to the second page. Again, when we tap the button on the second page, it will return to the first page. The below code snippet creates two routes in the Flutter application.<a href=\"https:\/\/www.javatpoint.com\/flutter-navigation-and-routing#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-navigation-and-routing#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-navigation-and-routing#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class FirstRoute extends StatelessWidget {  \n  @override  \n  Widget build(BuildContext context) {  \n    return Scaffold(  \n      appBar: AppBar(  \n        title: Text('First Route'),  \n      ),  \n      body: Center(  \n        child: RaisedButton(  \n          child: Text('Open route'),  \n          onPressed: () {  \n            \/\/ Navigate to second route when tapped.  \n          },  \n        ),  \n      ),  \n    );  \n  }  \n}  \n  \nclass SecondRoute extends StatelessWidget {  \n  @override  \n  Widget build(BuildContext context) {  \n    return Scaffold(  \n      appBar: AppBar(  \n        title: Text(\"Second Route\"),  \n      ),  \n      body: Center(  \n        child: RaisedButton(  \n          onPressed: () {  \n            \/\/ Navigate back to first route when tapped.  \n          },  \n          child: Text('Go back!'),  \n        ),  \n      ),  \n    );  \n  }  \n}  <\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, we are going to create two routes for navigation. In both routes, we have created only a&nbsp;single button.&nbsp;When we tap the button on the first page, it will navigate to the second page. Again, when we tap the button on the second page, it will return to the first page. The below code snippet [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2005"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=2005"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2005\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=2005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=2005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=2005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}