navigateBack method

void navigateBack({
  1. required BuildContext context,
})

Implementation

void navigateBack({required BuildContext context}) {
  if (routeHistory.isNotEmpty) {
    currentRoute = routeHistory.removeLast();
    debugPrint("Navigating back to $currentRoute");
    Navigator.pop(context);
  } else {
    debugPrint("Cannot navigate back; history is empty.");
  }
}