I'm attempting to create a web app in Flutter that would ideally work like a website. Users would log in and be able to see their dashboards with private information, but there are certain screens with public information that anyone could navigate to using a dynamic route URL like: myflutterapp.com/feed/usersPublicInfo, where this link could be posted to another website, for example, and the user could go straight into this route.
Clearly using named Routes is a solution I would need, but then what is preventing someone from going directly to a route where private information is? Or at least preventing a user from going to a page with null information and causing the widgets to crash?
Solution idea 1
Use named Routes and after the login screen, pass the user variable to each screen, and have a nullcheck before the route is generated. If it's null, that means someone skipped some routes and they are sent back to login
Solution idea 2
If possible, use a mix of named routes and "unnamed" routes, such as the feed, dashboard, and login screen. Once the user makes it to the dashboard, all routes are handled using Navigator.push(), preventing them from being reached from a URL
Other Solutions?
I'm fairly new at flutter and flutter web, so I could be going at this problem all wrong. I would appreciate some advice. Thanks!