-
Notifications
You must be signed in to change notification settings - Fork 260
Feat: fetchCurrentDevice API Implementation #5075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: fetchCurrentDevice API Implementation #5075
Conversation
packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart
Outdated
Show resolved
Hide resolved
attributes: { | ||
for (final attribute in attributes) | ||
attribute.name: attribute.value ?? '', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Does this need a for loop? Does attributes
have other properties?
attributes: { | |
for (final attribute in attributes) | |
attribute.name: attribute.value ?? '', | |
}, | |
attributes: attributes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Does this need a for loop?
Yes, it's for type conversion. At first glance it looks redundant, but the loop achieves two important things - converting null values to an empty string, and converting a BuiltList
to Map
Note that attributes: attributes
is type invalid. CognitoDevice
types its attributes
as map<string, string>
, while the attributes from the getDeviceResponse.device
(smithy-generatively) types its attributes
as BuiltList<AttributeType>?
.
Does
attributes
have other properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks for adding that context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of changes:
Implemented
fetchCurrentDevice
APIBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.