Hi! Here I presented only the code responsible for navigation. App, where I developed this pattern has both: login check and deep linking and it's written specifically having mobile in mind. The second one(deep linking) being a bit neglected though. In my app, there are two ways to navigate to the login page.
First, one is that I've made a wrapper for autologin with the future builder, then depending on what that wrapper returns I am either routing to the main app with described modules or to login/register page. This is always triggered when the app is brought back to life.
The second one is that you can navigate to the login page from ModuleNavigator using regular Naviagotor.of(context) as e.g. logout method. Since ModuleNavigator is an Inherited Widget that logout method is accessible throughout all the modules.
Additionally, to handle HTTP 401(and others) responses I used rxdart with stream builder to send information that the user is unauthorized and should be redirected to the login page. That addition makes my "error" handling much easier and I don't need to worry about catching any of them within the widget tree.
I am planning to describe this auth flow alongside pin/biometric in the near future in one of my next articles.
If you have any other questions feel free to ask. Here or on Twitter 😉