pop function

void pop(
  1. BuildContext context
)

Navigates back to the previous screen.

The Pop function checks if there is a previous screen in the navigation stack. If there is, it pops the current screen and navigates back to the previous screen. If there isn't, it does nothing.

  • context: The context of the current screen.

Implementation

void pop(BuildContext context) {
  Navigator.canPop(context) ? Navigator.pop(context) : null;
}