I have a problem with a redirection on main first screen app: i already tried use loadAccountFromCache() method, but it return a null argument.
I'm trying use a cached memory bool variable to control if user as logged in first time. If this is true, choose to make a new login taking all basic profile data and redirect to a Main Page.
But, when i use this criteria, the login method return a Exception: You are required to implement showAuthenticator or sharedShowAuthenticator. Being that this same login method work fine on Login Screen. In this case i'm using Azure Authentication Api module.
Below is described the method about user login verification, in which these return a Future widget to be choose on main file:
Future<Widget> verifyUser() async {
//verify if has internet connection
bool testConnection = await NoConnectionPage.verifyConnection();
if (!testConnection) {
//return a no connection widget in offline case
return NoConnectionPage();
} else {
//take azure api variables (clientID, clientSecret)
_azure = await _fb.azureVariables();
/* _userAzure = await AuthConfig.loadAccount(
AuthConfig.azureConn(_azure['clientID'], _azure['clientSecret']));
print(_userAzure.toString());*/
SharedPreferences prefs = await SharedPreferences.getInstance();
if (prefs.getBool("firstLogin") == true) {
_userAzure = await AuthConfig.login(
AuthConfig.azureConn(_azure["clientID"], _azure["clientSecret"]));
return MainPage(userAzure: _userAzure);
}
return LoginScreen();
}
}
*Note that comment piece was a tried account cached load call after a first login.
And finally, this is the login Authenticator and the loadAccount cached methods:
I have a problem with a redirection on main first screen app: i already tried use
loadAccountFromCache()
method, but it return a null argument. I'm trying use a cached memory bool variable to control if user as logged in first time. If this is true, choose to make a new login taking all basic profile data and redirect to a Main Page. But, when i use this criteria, the login method return a Exception:You are required to implement showAuthenticator or sharedShowAuthenticator
. Being that this same login method work fine on Login Screen. In this case i'm using Azure Authentication Api module. Below is described the method about user login verification, in which these return a Future widget to be choose on main file:*Note that comment piece was a tried account cached load call after a first login.
And finally, this is the login Authenticator and the loadAccount cached methods: