title: Route Guards in Flutter
body: <p>In Angular, one can use the <code>canActivate</code> for route guarding.</p>
  
  <p>In Flutter, how would one go about it? Where is the guard placed? How do you guard routes?</p>
  
  <p>I'm thinking along the lines of this:</p>
  
  <ul>
  <li>User logged in. Their token is stored in Shared Preference (the right way to store tokens? )</li>
  <li>User closed the app.</li>
  <li>User opens app again. As the application starts, it determines if user is logged in (perhaps a service that checks the storage for token), and then</li>
  <li>If logged in, load the homepage route</li>
  <li>If not logged in, load the login page</li>
  </ul>