mercredi 22 septembre 2021

if else statement inside if else ternary statement in dart

I have a case where i need to specify

if (_amplifyConifured) {
  if (_isUserIsLoggedIn) {
    return DashboardScreen.routeName;
  } else {
    return LoginScreen.routeName;
  }
} else {
  LoadingScreen.routeName;
}


Tried this:

 _amplifyConfigured ? 
          _isUserIsLoggedIn ? DashboardScreen.routeName : LoginScreen.routeName :
          LoginScreen.routeName : LoadingScreen.routeName

But it's not throwing error

Pls help

Aucun commentaire:

Enregistrer un commentaire