updateData method

Future<bool> updateData(
  1. String documentPath,
  2. Map<String, dynamic> data
)

Updates data in Firestore for an existing document using update.

  • documentPath: Path to the Firestore document.
  • data: The data to update.

Returns true if the operation is successful, false otherwise.

Implementation

Future<bool> updateData(String documentPath, Map<String, dynamic> data) async {
  try {
    await _firestore.doc(documentPath).update(data);
    debugPrint('Document updated successfully.');
    return true;
  } catch (e) {
    debugPrint('Error updating data in Firestore: $e');
    return false;
  }
}