onWillPop method

Future<bool> onWillPop()

call this when user presses the back button present within device controls

Implementation

Future<bool> onWillPop() async {
  if (isUserOnTheFirstPage) {
    return true;
  } else {
    goToPreviousPage();
    return false;
  }
}