Skip to main content

Get Conversations

Simplify your chat application development with LikeMinds Flutter Chat SDK. Enhance user conversations, enable real-time messaging, and provide seamless communication experiences with minimal coding effort. By utilizing this feature you can view all the conversations in the chatroom.

Steps to fetch Conversations inside a Chatroom

  1. Create an object of the GetConversationRequest class using the GetConversationRequestBuilder class.
  2. For creating a post call getConversation() present in LMChatClient class using your request object.
  3. Process the response (LMResponse<GetConversationResponse>) as per your requirement.
GetConversationRequest request = (GetConversationRequestBuilder()
..chatroomId(70989)
..page(1)
..pageSize(100)
..maxTimestamp(DateTime.now().millisecondsSinceEpoch)
..minTimestamp(0))
.build();

LMResponse<GetConversationResponse> response =
await lmChatClient.getConversation(request);

if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}

Models

GetConversationRequest

List of parameters for the GetConversationRequest class

VariableTypeDescriptionOptional
chatroomIdintChatroom Id
pageintPage number for API response
pageSizeintPage size for API response
maxTimestampintMaximum timestamp for API response
minTimestampintMinimum timestamp for API response
isLocalDBboolWhether to fetch from local DB or not

GetConversationResponse

List of parameters for the GetConversationResponse class

VariableTypeDescriptionOptional
successboolAPI success status
conversationDataList<Conversation>?List of conversations✔️
errorMessageString?Error log incase the API fails✔️
chatroomMetaMap<int, ChatRoom>?Map of chatroom meta data✔️
communityMetaMap<int, Community>?Map of community meta data✔️
userMetaMap<int, User>?Map of user meta data✔️
conversationMetaMap<String, Conversation>?Map of conversation meta data✔️
conversationAttachmentsMetaMap<String, dynamic>?Map of conversation attachments meta data✔️