goToPreviousPage method

Future<bool> goToPreviousPage({
  1. required BuildContext context,
  2. Map<String, dynamic>? item,
  3. dynamic quickDispose()?,
})

Implementation

Future<bool> goToPreviousPage(
    {required BuildContext context,
    Map<String, dynamic>? item,
    dynamic Function()? quickDispose}) async {
  if (pageQue.isNotEmpty) {
    _deliveringItem = item;
    QueRoute queRoute = pageQue.removeLast();
    if (quickDispose != null) {
      await quickDispose();
    }
    switch (lastNavigationType) {
      case NavigationType.go:
        GoRouter.of(context).go(queRoute.route);
        break;
      case NavigationType.push:
        Navigator.pop(context, item);
        break;
      case NavigationType.pushReplacement:
        Navigator.pop(context, item);
        break;
      case null:
        Navigator.pop(context, item);
        break;
    }
    lastNavigationType = queRoute.type;
    return false;
  } else {
    return true;
  }
}