Here is my code to get the current users phone number.
Future<void> getCurrentUser() async {
try {
AuthUser user = await Amplify.Auth.getCurrentUser();
print(user.signInDetails);
} on AuthException catch (e) {
safePrint('Error retrieving current user: ${e.message}');
}
}
The print statement above which extracts the values of the signInDetails array, does not allow me to go deeper one more level. Here is result if I just print the object instance -
CognitoSignInDetailsApiBased {
I/flutter (19338): "signInType": "apiBased",
I/flutter (19338): "username": "+14160000000",
I/flutter (19338): "authFlowType": "USER_SRP_AUTH"
I/flutter (19338): }
How do I just get the value of username element above.