flutter 输入电话号码时收到无效的电子邮件地址格式

u5rb5r59  于 2022-11-30  发布在  Flutter
关注(0)|答案(1)|浏览(156)

我正在做电话验证的Flutter与放大工作室。我得到这个错误时,我注册的电话号码。

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: InvalidParameterException(message: One or more parameters are incorrect., recoverySuggestion: Enter correct parameters., underlyingException: com.amazonaws.services.cognitoidentityprovider.model.InvalidParameterException: Invalid email address format. (Service: AmazonCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: d04e58b4-fe2d-4d02-987a-f640188903d3))

这是我注册的方式

Future<void> signUpWithPhoneVerification(
  ) async {
    await Amplify.Auth.signUp(
      username: _email.text,
      password: _password.text,
      options: CognitoSignUpOptions(
        userAttributes: <CognitoUserAttributeKey, String>{
          // ... if required
          CognitoUserAttributeKey.email: _email.text,
          CognitoUserAttributeKey.phoneNumber: _email.text,
        },
      ),
    );
  }
jxct1oxe

jxct1oxe1#

看起来您的代码中有一个拼写错误。请查看:

Future<void> signUpWithPhoneVerification(
  ) async {
    await Amplify.Auth.signUp(
      username: _email.text,
      password: _password.text,
      options: CognitoSignUpOptions(
        userAttributes: <CognitoUserAttributeKey, String>{
          // ... if required
          CognitoUserAttributeKey.email: _email.text,
          CognitoUserAttributeKey.phoneNumber: _email.text, // here :)
        },
      ),
    );
  }

相关问题