canGoHome static method

bool canGoHome(
  1. BuildContext context, [
  2. VyuhFailure? failure
])

Whether "Go home" can help: the router exists, the failure allows it, and the failure is not on the home route itself.

Implementation

static bool canGoHome(BuildContext context, [VyuhFailure? failure]) {
  if (GoRouter.maybeOf(context) == null) return false;
  if (failure != null && !failure.canGoHome) return false;
  final home = vyuh.router.homeLocation;
  return failure?.location == null || failure!.location!.path != home;
}