diff --git a/packages/amplify_authenticator/lib/src/mixins/authenticator_username_field.dart b/packages/amplify_authenticator/lib/src/mixins/authenticator_username_field.dart index b173f95441..3935acc4cc 100644 --- a/packages/amplify_authenticator/lib/src/mixins/authenticator_username_field.dart +++ b/packages/amplify_authenticator/lib/src/mixins/authenticator_username_field.dart @@ -27,20 +27,7 @@ mixin AuthenticatorUsernameField { @override UsernameInput? get initialValue { - String? username; - switch (selectedUsernameType) { - case UsernameType.username: - username = state.username; - break; - case UsernameType.email: - username = state.getAttribute(CognitoUserAttributeKey.email); - break; - case UsernameType.phoneNumber: - username = state.getAttribute(CognitoUserAttributeKey.phoneNumber); - break; - } - - return UsernameInput(type: selectedUsernameType, username: username ?? ''); + return UsernameInput(type: selectedUsernameType, username: state.username); } @override