1

我正在尝试使用一个简单的代码注册用户,其中我也硬编码了电子邮件和密码。代码如下所示:

Future<String> _Signup(BuildContext context) async { 
    try { 
        await Amplify.Auth.signUp( 
            username: 'johndoe@gmail.com', 
            password: 'john12345', 
            options: CognitoSignUpOptions( 
                userAttributes: {'email': 'johndoe@gmail.com'}
            )
        );
    } catch (e) { 
        return e.toString(); 
    } 
}

当我单击它时,会引发以下错误:

PlatformException (PlatformException(AuthException, Translating platform exception failed. Please take a look at https://github.com/aws-amplify/amplify-flutter/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't., {recoverySuggestion: See attached exception for more details., underlyingException: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool.signUp(java.lang.String, java.lang.String, com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserAttributes, java.util.Map, java.util.Map, com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.SignUpHandler)' on a null object reference, message: Sign up failed}, null))
4

0 回答 0