'BeamGuard, Provider, and Three Error Messages. (does not redirect properly, when hot-reload, 3 error messages)

Here's my _routerDelegate:

final _routerDelegate = BeamerDelegate(
  initialPath: '/',
  locationBuilder: BeamerLocationBuilder(
    beamLocations: [
      HomeLocation(),
      AuthLocation(),
    ],
  ),
  guards: <BeamGuard>[
    BeamGuard(
      pathPatterns: ['/'],
      check: (context, location) {
        print(
            'updated user state from main.dart: ${context.watch<UserProvider>().userState}');
        return context.watch<UserProvider>().userState; // true to HomeScreen()?
      },
      // showPage: BeamPage(child: AuthScreen(),), // <- stack overflow, adding Location doesn't work
      beamToNamed: (origin, target) => '/auth',
    ),
  ],
);

The problem I am getting is that even though I updated userState with a method, which is as the following, BeamGuard does not take me to HomeScreen().

  void setUserAuth(bool authState) {
    _userLoggedIn = authState;
    notifyListeners();
  }

  bool get userState => _userLoggedIn;

But when I hot reload, only by then something happens and the app gives me the following error messages:

Performing hot reload...                                          
Another exception was thrown: Navigator.onGenerateRoute was null,
but the route named "/" was referenced.
Performing hot reload...                                          
Another exception was thrown: A HeroController can not be shared
by multiple Navigators. The Navigators that share the same
HeroController are:
Performing hot reload...                                                
Reloaded 2 of 1002 libraries in 496ms.

Another exception was thrown: The Navigator.pages must not be
empty to use the Navigator.pages API

Another exception was thrown: Navigator.onGenerateRoute was null,
but the route named "/" was referenced.

Another exception was thrown: A HeroController can not be shared
by multiple Navigators. The Navigators that share the same
HeroController are:


I tried to search google or stackoverflow, but for any of those messages, I could not find any solution. Thereby I post this question. What are those error messages, and why are they relevant here?

Flutter (Channel stable, 2.10.4, on Ubuntu 20.04.4 LTS 5.13.0-40-generic, locale en_US.UTF-8)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source