how to check for a user is authenticated and navigate to home in flutter code example
Example: 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(),
));
}