needRecheck method

bool needRecheck()

check if redirect is needed

Implementation

bool needRecheck() {
  if (settings == null && route != null) {
    settings = route;
  }
  final match = Get.routeTree.matchRoute(settings!.name!);
  Get.parameters = match.parameters;

  // No Match found
  if (match.route == null) {
    isUnknown = true;
    return false;
  }

  final runner = MiddlewareRunner(match.route!.middlewares);
  route = runner.runOnPageCalled(match.route);
  addPageParameter(route!);

  // No middlewares found return match.
  if (match.route!.middlewares == null || match.route!.middlewares!.isEmpty) {
    return false;
  }
  final newSettings = runner.runRedirect(settings!.name);
  if (newSettings == null) {
    return false;
  }
  settings = newSettings;
  return true;
}