Skip to content

Instantly share code, notes, and snippets.

@salihgueler
Created May 12, 2023 09:57
Show Gist options
  • Save salihgueler/244e96237279a8b93c09bb743e668e0f to your computer and use it in GitHub Desktop.
Save salihgueler/244e96237279a8b93c09bb743e668e0f to your computer and use it in GitHub Desktop.
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