onRedirect method
Invoked when the redirect counter reaches maxRedirects.
The default implementation returns GuardResult.cancel. Override in subclasses to customise the behaviour (for example, to redirect to an error route).
Implementation
@protected
GuardResult onRedirect(
RouteNode origin,
RouteNode target,
Map<String, Object> context,
int redirectCount,
) =>
const GuardResult.cancel(reason: 'Max redirects reached');