Elwalid
Elwalid

Reputation: 1

App get blocked after pressing sign in button with firebase

I have a problem with my Flutter app, after running it going to the sign-in page and filling the info. the app gets blocked after pressing the sign-in button. the await became green after the app got blocked

Future<void> saveUserToFirestore(
      bio, city, country, email, firstName, lastName, id) async {
      Map<String, dynamic> dataMap = {
      "bio": bio,
      "city": city,
      "country": country,
      "email": email,
      "firstName": firstName,
      "lastName": lastName,
      "isHost": false,
      "myPostingIDs": [],
      "savedPostingIDs": [],
      "earnings": 0,
      };

      await FirebaseFirestore.instance.collection("users").doc(id).set(dataMap);
      }

i made before that await but this time this await became green and still have the same issue:

  class UserViewModel {
    signUp(email, password, firstName, lastName, city, country, bio,
    imageFileOfUser) async {
    Get.snackbar("pleas wait", "we are creating an account for you ");
    await FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password:                           password).then((result) async {
      String currentUserId = result.user!.uid;
      AppConstants.currentUser.id = currentUserId;
      AppConstants.currentUser.firstName = firstName;
      AppConstants.currentUser.lastName = lastName;
      AppConstants.currentUser.city = city;
      AppConstants.currentUser.country = country;
      AppConstants.currentUser.bio = bio;
      AppConstants.currentUser.email = email;
      AppConstants.currentUser.password = password;
      await saveUserToFirestore(
      bio, city, country, email, firstName, lastName, currentUserId).whenComplete(() 
      {
      addImageToFirebaseStorage(imageFileOfUser, currentUserId);
   });
      Get.snackbar("Congratulations", "your account has been created ");
 });
}

Upvotes: 0

Views: 24

Answers (0)

Related Questions