Reputation: 786
I want to know how can I link a page to previous, instead of choosing an only path, because sometimes there is other paths to the same page.
Navigator.pop(context);
Haven't worked for me, I only get a black screen.
Upvotes: 1
Views: 175
Reputation: 254
it depends on the way how you opened the page;
open new screen:
// Within the First Page widget
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondPage()),
);
now you can return to the first page using Navigator.pop() like that :
// Within the Second Page widget
Navigator.pop(context);
Upvotes: 1