findConversationById static method

dynamic findConversationById({
  1. required String conversationId,
  2. required ChatConversationType type,
})

Implementation

static findConversationById(
    {required String conversationId,
    required ChatConversationType type}) async {
  QuerySnapshot q = await FirebaseFirestore.instance
      .collection(kCollectionCONVERSATIONS)
      .where(kDbCONVERSATIONTYPE,
          isEqualTo: type == ChatConversationType.group ? kDbGroup : kDbSOLO)
      .where(kDbCONVERSATIONID, isEqualTo: conversationId)
      .get();
  if (q.size > 0) {
    return q.docs.first.data();
  }
}