streamAll method

Stream<QuerySnapshot<Map<String, dynamic>>> streamAll()

Streams all documents from a collection with exception handling

Returns real-time updates for all documents with error conversion Provides raw Firestore data without conversion

Returns Stream of QuerySnapshot containing:

Example:

final stream = api.streamAll();
stream.listen(
  (snapshot) {
    for (var doc in snapshot.docs) {
      print('User data: ${doc.data()}');
    }
  },
  onError: (error) {
    if (error is TurboFirestorePermissionDeniedException) {
      print('Permission denied: ${error.message}');
    }
  }
);

See also: streamAllWithConverter type-safe streaming streamByQuery filtered streaming

Implementation

Stream<QuerySnapshot<Map<String, dynamic>>> streamAll() {
  final path = _collectionPath();
  _log.debug(
    message: 'Finding stream..',
    sensitiveData: SensitiveData(
      path: path,
    ),
  );
  return listCollectionReference().snapshots().handleError(
    (error, stackTrace) {
      _log.error(
        message: 'Error streaming collection',
        sensitiveData: SensitiveData(
          path: path,
        ),
        error: error,
        stackTrace: stackTrace,
      );
      throw TurboFirestoreException.fromFirestoreException(
        error,
        stackTrace,
        path: path,
      );
    },
  );
}