0

I have been able to upload the data to my firestore using the codes below.

class AddressUpdate {
  final String phonenumber;
  final String address1;
  final String address2;
  final String city;
  final String state;
  final String zipCode;
  final String uid;

  AddressUpdate(
      {
      this.phonenumber,
      this.address1,
      this.address2,
      this.city,
      this.state,
      this.zipCode,
      this.uid});
}

// add address to firestore
  Future<void> updateAddress(
      address1, address2, phonenumber, city, state, zipCode) async {
    return await signUpCollection.document(uid).collection('address').add({
      'address1': address1,
      'address2': address2,
      'phonenumber': phonenumber,
      'city': city,
      'state': state,
      'zipcode': zipCode,
    });
  }

Future updateAddress(address1, address2,  phonenumber,
      city, state, zipCode) async {
    notifyListeners();
    FirebaseUser user = await _auth.currentUser();
    await Database(uid: user.uid).updateAddress(address1, address2, 
        phonenumber, city, state, zipCode);
  }

How DO I fetch the whole data from the address collection so that I can be able to update each data separately since add method has a uid.

0 Answers0