简体   繁体   中英

How to register with extra credentials in flutter/firebase?

I am totally new to flutter and firebase and i saw some videos of signup and login but i noticed that everyone uses this method _auth.createUserWithEmailAndPassword(email: null, password: null) to create new registration, however I want to register a user along with their other information such as address, contact etc. Is it possible, if yes how? any kind of video will be useful

auth.createUserWithEmailAndPassword(email: null, password: null) this will create an authenticated user in the firebase console. If you want to add extra information, then you need to add that information to the database, example:

    firebaseAuth
        .createUserWithEmailAndPassword(
            email: emailController.text, password: passwordController.text)
        .then((result) {
      dbRef.child(result.user.uid).set({
        "email": emailController.text,
        "age": ageController.text,
        "name": nameController.text
      }).then((res) {
        Navigator.pushReplacement(
          context,
          MaterialPageRoute(builder: (context) => Home(uid: result.user.uid)),
        );
      });

Here we add age , email , and name to firebase realtime database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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