in my flutter app I want to check if a user is logged in before or not and based on this navigate them to either HomePage or SignIn page. The code I am using is not working fine, it is not navigating to the SignIn page after I've done registration and deleted the account in Firebase Console. In short, when I delete a user, who registered well before, in Firebase Console the application is keeping to show the HomePage and all the posts the user made. How can I handle it?

**"In short, I want to navigate the user to SignIn page after I delete his account in Firebase Console"**

Here is the code in my main.dart file:

```
_check(){
 final FirebaseAuth auth = FirebaseAuth.instance;
 final User? user = auth.currentUser;
 if(user == null){
   HiveDB.deleteUser();
   return SignInPage();
 }
 HiveDB.putUser(id: user.uid);
 return HomePage();
}

@override
void initState() {
  // TODO: implement initState
  super.initState();
   _check();
}

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: _check(),
    routes: {
      SignInPage.id:(context) => SignInPage(),
      SignUpPage.id:(context) => SignUpPage(),
      HomePage.id:(context) => HomePage(),
    },
  );
}

```

The \_check() function is not working as it's desired...