updateData method
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;
}
}