findStreamWithConverter method

Stream<List<T>> findStreamWithConverter()

Finds a Stream of list of T based on specified _collectionPath (all documents).

Make sure to have specified the _toJson and _fromJson methods or else the FirestoreApi will not now how to convert the data to T.

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 raw form of a List<Map<String, dynamic>> consider using the findStream method instead.

Implementation

Stream<List<T>> findStreamWithConverter() {
  _log.info('🔥 Finding ${_collectionPath()} Collection Stream with converter..');
  return findCollectionWithConverter().snapshots().map(
        (event) => event.docs.map((e) => e.data()).toList(),
      );
}