addSubCollectionDocument method
Implementation
Future<String?> addSubCollectionDocument({
required String collection,
required String documentId,
required String subCollection,
required Map<String, dynamic> update,
String? subCollectionDocumentId,
}) async {
try {
final DocumentReference documentReference =
_firebaseFirestore.collection(collection).doc(documentId).collection(subCollection).doc(subCollectionDocumentId);
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;
}
}