goBack static method

bool goBack(
  1. BuildContext context
)

Goes back to the previous screen.

Implementation

static bool goBack(BuildContext context) {
  if (screenNotifier.value.runtimeType ==
      PageManager.homeScreen.runtimeType) {
    return false;
  }
  if (screenNotifier.value.previousPage != null) {
    pages.clear();
    screenNotifier.value = screenNotifier.value.previousPage!;
  } else {
    if (pages.length < 2) {
      screenNotifier.value = homeScreen;
    } else {
      pages.removeLast();
      screenNotifier.value = pages.removeLast();
    }
  }
  return false;
}