1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Error :[cloud_firestore/not-found] Some requested document was not found

Discussão em 'Mobile' iniciado por Stack, Outubro 17, 2024 às 14:32.

  1. Stack

    Stack Membro Participativo

    I recently wrote a program in one part of which the user is supposed to register his address and be able to choose the desired address, but as you can see, I get the following error when the address is clicked.

    I/flutter ( 8467): [cloud_firestore/not-found] Some requested document was not found.


    Address Controller

    Future selectAddress(AddressModel newSelectedAddress) async {

    // Clear the "selected" field
    if (selectedAddress.value.id.isNotEmpty) {
    await addressRepository.updateSelectedField(
    selectedAddress.value.id, false);
    }

    // Assign selected address
    newSelectedAddress.selectedAddress = true;
    selectedAddress.value = newSelectedAddress;
    print(selectedAddress.value.id);

    //Set the "selected" field to true for the newly selected address
    await addressRepository.updateSelectedField(
    selectedAddress.value.id, true);

    Get.back();
    }
    }



    Address Repository

    Future<void> updateSelectedField(String addressId, bool selected) async {
    try {
    final userId = AuthenticationRepository.instance.authUser.uid;
    await _db.collection('Users').doc(userId).collection('Addresses').doc(addressId).update({'SelectedAddress': selected});
    } catch (e) {
    print(e);
    throw 'Something went wrong while fetching Address Information. Try again later';
    }
    }


    Firebase Database:

    [​IMG]

    Continue reading...

Compartilhe esta Página