addDocument method
Implementation
Future<String?> addDocument(
String collection,
Map<String, dynamic> update, {
String? documentId,
}) async {
try {
final DocumentReference documentReference = _firebaseFirestore.collection(collection).doc(documentId);
await documentReference.set(update);
_loggingService.log(
'FirestoreGenericService.setDocument: Set. Collection $collection, DocID: ${documentReference.id}, Update: $update');
return documentReference.id;
} catch (e) {
_loggingService.log(
'FirestoreGenericService.setDocument: Set failed. Update: $update, Exception: ${e.toString()}',
logType: LogType.error,
);
return null;
}
}