I have a login screen, in my form button, i do the check and then call Shared Preferences to set the login flag, and initState i call a method to check the value and redirect to homeScreen. Now all went well, but i am able to see the login form for a second or so, then i get redirected to home. I wish to not see the login form at all. How can i do that? Here is the content of initState method:
_loadLoginStatus() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
_loginStatus =prefs.getBool('loginStatus') ?? false;
if(_loginStatus == true){
Navigator.push(
context, MaterialPageRoute(builder: (context) => HomeScreen()));
}
});
}