flutter check if logged in
Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final SharedPreferences prefs = await SharedPreferences.getInstance(); var isLoggedIn = (prefs.getBool('isLoggedIn') == null) ? false : prefs.getBool('isLoggedIn'); runApp(MaterialApp( debugShowCheckedModeBanner: false, home: isLoggedIn ? anotherPage() : loginPage(), )); }