简体   繁体   English

Flutter用户注册存储数据

[英]Flutter user registration storing data

I'm new to flutter. 我是新来的。 I need some help with Registering users with my app. 我需要一些有关在我的应用程序中注册用户的帮助。 I'm using Firebase authentication just to get the email and I need to save the details of the users in a database. 我使用Firebase身份验证只是为了获取电子邮件,并且需要将用户的详细信息保存在数据库中。 I'm trying with cloud firestore, but I'm feeling like its not the best ideal option. 我正在尝试使用Cloud Firestore,但我感觉它不是最佳的理想选择。 And when login I want verify if the user is registered or not 当登录时,我想验证用户是否已注册

you can use this code for registration user in Cloud Firestore 您可以将此代码用于Cloud Firestore中的注册用户

    final FirebaseAuth _auth = FirebaseAuth.instance;

     _auth
                  .createUserWithEmailAndPassword(
                      email: _myEmail, password: _myPassword)
                  .catchError((e) {
                showDialog(
                    context: context,
                    builder: (context) {
                      return CupertinoAlertDialog(
                        title: Text('Error Occured'),
                        content: Text(e.toString()),
                        actions: <Widget>[
                          CupertinoButton(
                              child: Text('Ok'),
                              onPressed: () => Navigator.of(context).pop())
                        ],
                      );
                    });   



         FirebaseAuth.instance
                      .signInWithEmailAndPassword(email: _myEmail, password: _myPassword)
                      .catchError((e) {
                    showDialog(
                        context: context,
                        builder: (context) {
                          return CupertinoAlertDialog(
                            title: Text('Error Occured'),
                            content: Text(e.toString()),
                            actions: <Widget>[
                              CupertinoButton(
                                  child: Text('Ok'),
                                  onPressed: () => Navigator.of(context).pop())
                            ],
                          );
                        });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM