I'm trying to find whether the logged in user is an admin or a normal user.
I have already created a global function (then called it in `initState`) to check whether the role is admin or not by setting a bool to true or false as follows:

```
bool isAdmin;
  _checkRole() async {
    var firebaseUser = FirebaseAuth.instance.currentUser;
    await FirebaseFirestore.instance
        .collection("users")
        .doc(firebaseUser.uid)
        .get()
        .then((value) {
      if ((value.data()['role']) == 'admin') {
        isAdmin = true;
      } else {
        isAdmin = false;
      }
      return isAdmin;
    });
  }

```

And here in the drawer I did the following:

```
          isAdmin
              ? buildListTile(
                  'Admin Panel', Icons.admin_panel_settings_sharp, () {
                  Navigator.of(context).pushNamed(AdminScreen.routeName);
                })
              : buildListTile('User dashboard', Icons.person, () {}),

```

But when I open the drawer, I receive `Failed assertion: boolean expression must not be null`
Any idea on how to fix this issue?

and thank you.