2

I write a flutter web sample app that uses bloc as many samples on the internet. Imagine a simple flutter project with the bloc to the login user. Get a username and pass and pass to bloc and UI automatically show home page now the problem is: this is web project after login when the user refreshes the browser login page popup again. How to manage to load the main page even after the page refresh?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • https://stackoverflow.com/questions/62237262/flutter-web-detect-browser-tab-close-or-refresh – hiashutoshsingh Oct 02 '20 at 09:38
  • @hiashutoshsingh I'm not sure that this is allowed: https://dart-lang.github.io/linter/lints/avoid_web_libraries_in_flutter.html Any other solutions guys?? – atereshkov Nov 13 '20 at 12:39

2 Answers2

0

I use localStorage with a token cached. Refreshing a page on a web is basically re-rendering all resources(maybe that's why Flutter Web only supports hot restart but not hot reload). For me, when I need to check login status or user data, I use a cached token(in case I use server), or a Firebase auth listener(if I use Firebase) before showing any UI.

-3

I make it work with State Management there are many solutions for state management I use Change Notifier State management