reevaluateGuards method

Future<void> reevaluateGuards()

Re-builds all routes in stack and reevaluate guarded once by re-visiting the onNavigation method when evaluation logic changes

e.g when the user is no longer authenticated and there are auth-protected routes in the stack

Implementation

Future<void> reevaluateGuards() async {
  final matches = await _composeMatchesForReevaluate();
  if (matches.isNotEmpty && !_isReevaluating) {
    _isReevaluating = true;
    await _navigateAll(matches, isReevaluating: true);
    _isReevaluating = false;
  }
  notifyAll();
}