let say I have 2 pages, PageA and PageB.
if a user tap a button in PageA then it will move to PageB using the code below
Navigator.of(context).pushNamed("pageB");
so as a result, there is back button in the top left app bar in PageB
my question is .....
how do I know if a page is pushed or not? I want to do something only if there is a back button in the appbar in a page
CodePudding user response:
You can use this:
final hasPagePushed = Navigator.of(context).canPop();
This is actually what the flutter's AppBar
is using to know whether or not it should display the back button.