getCommentStream method

Stream<List<CommentModel>> getCommentStream(
  1. String id
)

Returns a stream of comments with the given id.

Implementation

Stream<List<CommentModel>> getCommentStream(String id) {
  return instance
      .collection('comments')
      .doc(id)
      .withConverter(
        fromFirestore: (snapshot, _) => parseCommentData(snapshot.data()),
        toFirestore: (_, __) => {},
      )
      .snapshots()
      .asyncExpand((event) async* {
    yield event.data()!;
  });
}