微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试注册时出现平台异常

如何解决尝试注册时出现平台异常

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

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 举报,一经查实,本站将立刻删除。