stream method

Stream<T> stream()

Streams the results of the query as a stream of type T.

Implementation

Stream<T> stream() async* {
  Deserializer? deserializer = FS.deserializers[T];
  if (deserializer == null) {
    throw UnsupportedError('No serializer found for type: $T. Consider re-generating Firestorm data classes.');
  }
  Stream<QuerySnapshot<Object?>> snapshots = query.snapshots();
  await for (QuerySnapshot<Object?> snapshot in snapshots) {
    for (QueryDocumentSnapshot<Object?> doc in snapshot.docs) {
      yield deserializer(doc.data() as Map<String, dynamic>);
    }
  }
}