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
- Create an object of the
GetParticipantsRequestclass. - Call the
getParticipants()function using the instance of theLMChatClientclass. - 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
| Variable | Type | Description | Optional |
|---|---|---|---|
chatroomId | int | Unique ID of the chatroom | |
page | int | Page number for paginated response | |
pageSize | int | Page size for paginated response | |
isSecret | bool | Indicates if the chatroom is secret | |
search | String? | Search string for filtering participants | ✔️ |
GetParticipantsResponse
List of parameters for the GetParticipantsResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
canEditParticipant | bool? | Indicates if the user can edit participant details | ✔️ |
participants | List<User>? | List of participants in the chatroom | ✔️ |