尝试注册时出现平台异常

问题描述

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

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,com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.SignUpHandler)' on a null object reference,message: Sign up Failed},null))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)