findDocStream method

Stream<DocumentSnapshot<Map<String, dynamic>>> findDocStream({
  1. required String id,
  2. String? collectionPathOverride,
})

Finds a Stream of type Map<String, dynamic> based on given id.

If _tryAddLocalId is true then your data will also contain a local id field based on the _idFieldName specified in the constructor. Add this id field to your T and you will have easy access to the document id at any time.

If _tryAddLocalDocumentReference is true then your data will also contain a local reference field based on the _documentReferenceFieldName specified in the constructor. Add this reference field to your T and you will have easy access to the document reference at any time.

If you rather want to retrieve data in the form of T consider using the findDocStreamWithConverter method instead.

Implementation

Stream<DocumentSnapshot<Map<String, dynamic>>> findDocStream({
  required String id,
  String? collectionPathOverride,
}) {
  final docRef =
      findDocRef(id: id, collectionPathOverride: collectionPathOverride);
  _log.info(
    message: 'Finding doc stream..',
    sensitiveData: _shouldNotSensitiveInfo
        ? null
        : SensitiveData(
            path: collectionPathOverride ?? _collectionPath(),
            id: id,
          ),
  );
  return docRef.snapshots();
}