I am trying to check the login of the user. But, checklogin() even on returning null doesn't equate to null in the if condition.
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
if(checkLogin() == null) {
return Login();
} else {
return Dashboard();
}
}
Future<String> checkLogin() async {
var prefs = await SharedPreferences.getInstance();
var key = 'Token';
var value = prefs.getString(key);
print(value);
return value;
}
}