getEmail method

Future<LinkedInEmail> getEmail (
  1. {PreferredSizeWidget appBar,
  2. bool destroySession: true,
  3. bool forceLogin: false}
)

Implementation

Future<LinkedInEmail> getEmail(
    {PreferredSizeWidget appBar,
    bool destroySession = true,
    bool forceLogin = false}) async {
  if (accessToken == null || forceLogin)
    await loginForAccessToken(destroySession: destroySession, appBar: appBar);
  return await getEmailResponse(accessToken: accessToken).catchError((error) {
    if (error is AuthorizationErrorResponse)
      throw error;
    else
      throw AuthorizationErrorResponse(errorDescription: error.toString());
  });
}