redirectDelegate method

  1. @override
Future<GetNavConfig?> redirectDelegate(
  1. GetNavConfig route
)

Similar to redirect, This function will be called when the router delegate changes the current route.

The default implmentation is to navigate to the input route, with no redirection.

if this returns null, the navigation is stopped, and no new routes are pushed. {@tool snippet}

GetNavConfig? redirect(GetNavConfig route) {
  final authService = Get.find<AuthService>();
  return authService.authed.value ? null : RouteSettings(name: '/login');
}

{@end-tool}

Implementation

@override
Future<GetNavConfig?> redirectDelegate(GetNavConfig route) =>
    SynchronousFuture(route);