class SplashServices {
UserPreferences userPreferences = UserPreferences();
void isLogin() {
userPreferences.getUser().then((value) {
if (value.token!.isNotEmpty && value.token.toString() != 'null') {
Timer(
const Duration(seconds: 5), () => Get.toNamed(RouteName.homeView));
} else {
Timer(
const Duration(seconds: 5), () => Get.toNamed(RouteName.loginView));
}
});
}
}
Since I am facing the problem of using null check operator on a null value
So
Kindly provide an alternate method to solve it.
2
Answers
In your "If" statement, first check "value" is null or not and then do other checks. Do this (if(value==null)) first
Here is issue is you check "null"
Happy Coding…