Created
May 12, 2023 09:57
-
-
Save salihgueler/244e96237279a8b93c09bb743e668e0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
printUserAttributes(); | |
} | |
Future<void> printUserAttributes() async { | |
try { | |
final attributes = await Amplify.Auth.fetchUserAttributes(); | |
safePrint('User attributes: $attributes'); | |
} on AuthException catch (e) { | |
switch (e) { | |
case AuthNotAuthorizedException _: | |
case SessionExpiredException _: | |
safePrint('Session is invalid: $e'); | |
case _: | |
safePrint('An unknown error occurred: $e'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment