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
- Create an object of the
GetConversationRequest
class using theGetConversationRequestBuilder
class. - Call
getConversation()
present in theLMChatClient
class using your request object. - Process the response LMResponse<
GetConversationResponse
> as per your requirement.
GetConversationRequest request = (GetConversationRequestBuilder()
..chatroomId("ENTER_CHATROOM_ID")
..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.errorMessage);
}
Models
GetConversationRequest
List of parameters for the GetConversationRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
chatroomId | int | Chatroom ID | |
page | int | Page number for API response | |
pageSize | int | Page size for API response | |
maxTimestamp | int | Maximum timestamp for API response | |
minTimestamp | int | Minimum timestamp for API response | |
isLocalDB | bool | Whether to fetch from local DB or not |
GetConversationResponse
List of parameters for the GetConversationResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
conversationData | List<Conversation>? | List of conversations | ✔️ |
chatroomMeta | Map<int, ChatRoom>? | Map of chatroom meta data | ✔️ |
communityMeta | Map<int, Community>? | Map of community meta data | ✔️ |
userMeta | Map<int, User>? | Map of user meta data | ✔️ |
conversationMeta | Map<String, Conversation>? | Map of conversation meta data | ✔️ |
conversationAttachmentsMeta | Map<String, Attachment>? | Map of conversation attachments meta data | ✔️ |