onCredentialReceived method
A method that is called when the user has successfully completed the
authentication process and decides what to do with the obtained
credential
.
linkWithCredential and respectful lifecycle hooks are called if action
is AuthAction.link.
signInWithCredential and respectful lifecycle hooks are called
if action
is AuthAction.signIn.
FirebaseAuth.createUserWithEmailAndPassword
and respectful lifecycle
hooks are called if action is AuthAction.signUp.
Implementation
@override
void onCredentialReceived(
fba.EmailAuthCredential credential,
AuthAction action,
) {
switch (action) {
case AuthAction.signIn:
signInWithCredential(credential);
break;
case AuthAction.signUp:
if (shouldUpgradeAnonymous) {
return linkWithCredential(credential);
}
signUpWithCredential(credential);
break;
case AuthAction.link:
linkWithCredential(credential);
break;
case AuthAction.none:
super.onCredentialReceived(credential, action);
break;
}
}