Issue
I am an android developer and now learning about flutter development. In flutter navigator is using to move one page to another like intents in android. While I am using navigate, the back is goes to the initial page.
Am using the below code for navigation.
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (c) => widget.user ? Dashboard() : Login()),
);
Solution
You can use Navigator.push(context) for navigate from one page another using button, like the following:
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ScreenDashboard(),
),
);
},
Answered By - Shabbir Rajput
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.