appleSignIn method

Future<AuthorizationCredentialAppleID?>? appleSignIn()

Implementation

Future<AuthorizationCredentialAppleID?>? appleSignIn() async {
  try {
    if (await SignInWithApple.isAvailable()) {
      final credential = await SignInWithApple.getAppleIDCredential(
        scopes: [
          AppleIDAuthorizationScopes.email,
          AppleIDAuthorizationScopes.fullName,
        ],
      );
      log("Apple Credentials are -> ${credential.email} :: ${credential.givenName} "
          " ${credential.userIdentifier}");
      return credential;
    }
  } catch (e) {
    log("apple sign-in error -> $e");
  }
  return null;
}