In my app, there is a login screen, registration screen and a showProfile screen. I am registering user with email and password. In the registration screen there are fields contain Image, first name, last name , & phone no. I can add the user display name, image URL to the specific user by doing this-
UserCredential user = await _auth.createUserWithEmailAndPassword(email: _email, password: _password);
var newUser = user.user;
if (newUser != null) {
Reference imgReference = firebaseStorage.ref().child('UserImages/$_email');
UploadTask uploadTask = imgReference.putFile(imgFile);
TaskSnapshot taskSnapshot = await uploadTask;
String url = await taskSnapshot.ref.getDownloadURL();
if (url != null) {
setState(() {
imgUrl = url;
});
}
await newUser.updatePhotoURL(imgUrl);
await newUser.updateDisplayName(_firstName + ' ' + _lastName);
await newUser.reload();
}
Now I want to add phone no with OTP verification to the user during registration process. . but I can't able to the the same thing for phone no without creating another user account with phone no.
So that after successful login, in my showProfile screen I can parse user phone no. by user.phoneNumber to the screen just like I can do this for user.displayName & user.photoURL without facing any problem.
Is there any way to add phone no to the registered email account? I searched about it but couldn't find anything to start with.