The only information I can get from google sign in is the displayname, email, number and etc. I would also like to get the birthdate but it isn't available. Can you help me? Thank you!
Here is my code for getting user information after logging in using google.
final GoogleSignIn _googleSignIn = GoogleSignIn();
var googleIdToken;
FirebaseUser user;
Future<FirebaseUser> signInWithGoogle() async {
final GoogleSignInAccount googleSignInAccount = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication = await googleSignInAccount.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken);
googleIdToken = googleSignInAuthentication.idToken;
final AuthResult authResult = await _auth.signInWithCredential(credential);
user = authResult.user;
AuthService().googleLogin(googleIdToken).then((val) {
if (val.data['success']) {
var token2 = val.data['token'];
AuthService().getInfo(token2).then((val) async {
var store = val.data['user'];
await UserSimplePreferences.setEmail(store['email']);
await UserSimplePreferences.setFirstName(store['firstname']);
await UserSimplePreferences.setLastName(store['lastname']);
await UserSimplePreferences.setUsername(store['username']);
showDialog(context: context,
builder: (BuildContext context){
return _SuucessLogin();
});
EasyLoading.dismiss();
});
} else {
print('WRONG EMAIL/ PASS');
}
});
assert(!user.isAnonymous);
assert(await user.getIdToken() != null);
final FirebaseUser currentUser = await _auth.currentUser();
assert(currentUser.uid == user.uid);
return user;
}