getMessages function

Stream<List<ChatMessage>> getMessages(
  1. String channelId
)

Implementation

Stream<List<ChatMessage>> getMessages(String channelId) =>
    FirebaseFirestore.instance
        .collection('channels/$channelId/messages')
        .snapshots()
        .map((event) => event.docs
            .map((e) => ChatMessage(
                  message: e.data()["message"] as String,
                  date: e.data()["date"] as int,
                  author: e.data()["author"] as String,
                  profilePhoto: e.data()["profilePhoto"] as String,
                  uid: e.data()["uid"] as String,
                ))
            .toList());