Skip to main content

View Participants

To retrieve the list of participants in a chatroom, LikeMinds Flutter Chat SDK provides this feature. It enables you to retrieve user details, such as usernames or profile information, for better engagement and interaction within the chatroom.

Steps to Get the List of Participants in a Chatroom

  1. Create an object of the GetParticipantsRequest class.
  2. Call the getParticipants() function using the instance of the LMChatClient class.
  3. Process the response LMResponse<GetParticipantsResponse> as per your requirement.
GetParticipantsRequest request = (GetParticipantsRequestBuilder()
..chatroomId("ENTER_CHATROOM_ID")
..page(1)
..pageSize(10)
..isSecret(false) //set to true for secret chatroom
..search('ENTER_PARTICIPANT_NAME_TO_SEARCH'))
.build();

LMResponse<GetParticipantsResponse> response = await lmChatClient.getParticipants(request);

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

Models

GetParticipantsRequest

List of parameters for the GetParticipantsRequest class

VariableTypeDescriptionOptional
chatroomIdintUnique ID of the chatroom
pageintPage number for paginated response
pageSizeintPage size for paginated response
isSecretboolIndicates if the chatroom is secret
searchString?Search string for filtering participants✔️

GetParticipantsResponse

List of parameters for the GetParticipantsResponse class

VariableTypeDescriptionOptional
canEditParticipantbool?Indicates if the user can edit participant details✔️
participantsList<User>?List of participants in the chatroom✔️