onCredentialReceived method
Future<void>
onCredentialReceived(
- AuthCredential credential
)
inherited
Implementation
Future<void> onCredentialReceived(AuthCredential credential) async {
late AuthState finalState;
try {
switch (action) {
case AuthAction.signIn:
value = const SigningIn();
try {
final user = await signIn(credential);
if (user != null) {
finalState = SignedIn(user);
}
} on Exception catch (err) {
return handleError(err);
}
break;
case AuthAction.link:
value = CredentialReceived(credential);
await link(credential);
finalState = CredentialLinked(credential);
break;
default:
throw Exception('$action is not supported by $runtimeType');
}
if (value is! AuthFailed) {
value = finalState;
}
} on Exception catch (err) {
value = AuthFailed(err);
}
}