listenToSubCollectionDocument<T> method
Implementation
StreamSubscription<DocumentSnapshot> listenToSubCollectionDocument<T>({
required String collection,
required String documentId,
required String subCollection,
required String subCollectionDocumentId,
required String logReference,
required ValueSetter<DocumentSnapshot> onDocumentChange,
}) {
final StreamSubscription<DocumentSnapshot> streamSubscription = _firebaseFirestore
.collection(collection)
.doc(documentId)
.collection(subCollection)
.doc(subCollectionDocumentId)
.snapshots()
.listen((event) {
_loggingService
.log('FirestoreGenericService.listenToSubCollectionDocument.$logReference: New event. Collection: $collection, '
'DocId: $documentId, SubCollection: $subCollection, SubCollectionDocId: $subCollectionDocumentId');
onDocumentChange(event);
});
return streamSubscription;
}