checkGuard method

Future<ResolverResult> checkGuard(
  1. AutoRouteGuard guard,
  2. StackRouter router
)

Checks the provided guard and waits for it to complete

If there's an ongoing guard check, it waits for it to complete first before checking the provided guard returns the ResolverResult of the guard check

Implementation

Future<ResolverResult> checkGuard(AutoRouteGuard guard, StackRouter router) async {
  if (_waitingCompleter != null) {
    await _waitingCompleter!.future;
    _waitingCompleter = null;
    if (isResolved) return future;
  }
  _waitingCompleter = Completer<void>();
  await guard.onNavigation(this, router);
  _waitingCompleter!.complete();
  return future;
}