changeInfo function

Future<String?> changeInfo(
  1. String name,
  2. String email,
  3. String phone
)

Implementation

Future<String?> changeInfo(String name, String email, String phone) async{
  try{
    User? user = FirebaseAuth.instance.currentUser;
    if (user == null)
      return "user == null";
    if (userAccountData.userSocialLogin.isEmpty)
      await user.updateEmail(email);
    await FirebaseFirestore.instance.collection("listusers").doc(user.uid).set({
      "name": name,
      "phone": phone,
      "email": email
    }, SetOptions(merge:true));
    userAccountData.userPhone = phone;
    userAccountData.userEmail = email;
    userAccountData.userName = name;
  }catch(ex){
    return "changeInfo " + ex.toString();
  }
  return null;
}