socialGoogle static method
Future<Either<UserCredential, dynamic>>
socialGoogle(
)
Implementation
static Future<Either<UserCredential, dynamic>> socialGoogle() async {
final GoogleSignIn googleSignIn = GoogleSignIn();
googleSignIn.disconnect();
try {
final GoogleSignInAccount? googleSignInAccount =
await googleSignIn.signIn();
final GoogleSignInAuthentication? googleSignInAuthentication =
await googleSignInAccount?.authentication;
final AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleSignInAuthentication?.accessToken,
idToken: googleSignInAuthentication?.idToken);
final userCredential =
await FirebaseAuth.instance.signInWithCredential(credential);
return left(userCredential);
} catch (e) {
return right(e.toString());
}
}