Does anyone know why i got the Failed assertion: boolean expression must not be null. If I had logged in and quit the app and open the app again i should be directly in the home
Your issue most likely lies in this function where you're setting userIsLoggedIn
to null. Ensure getUserLoggedInSharedPreference
actually returns a boolean and not null.
void getLoggedInState() async {
final result = await HelperFunction.getUserLoggedInSharedPreference();
if (result != null) {
setState(() {
userIsLoggedIn = result;
});
} else {
print("result is null");
}
}