Skip to main content

Block Member

The blockMember() method is used to block a member from a specific chatroom. You can pass the required parameters such as the chatroomId and the status (which represents the block status).

Steps to Block a Member

  1. Create a BlockMemberRequest object with the required parameters such as chatroomId and status.
  2. Call the blockMember() function using the instance of the LMChatClient class.
  3. Use the response LMResponse<BlockMemberResponse> to fetch details about the conversation after blocking the member.
BlockMemberRequest request = (BlockMemberRequestBuilder()
..chatroomId("ENTER_CHATROOM_ID") // Provide the chatroom ID
..status(1)) // Provide the status to block (1 or another value for unblocking)
.build();

final LMResponse<BlockMemberResponse> response = await lmChatClient.blockMember(request);

if (response.success) {
// Use the returned conversation details
handleConversation(response.data.conversation);
} else {
// Handle error
handleError(response);
}

Models

BlockMemberRequest

List of parameters for the BlockMemberRequest class:

VariableTypeDescriptionOptional
chatroomIdintThe ID of the chatroom where the member will be blocked or unblocked
statusintThe block status
- 0 to Block Member
- 1 to Unblock Member

BlockMemberResponse

List of parameters for the BlockMemberResponse class:

VariableTypeDescriptionOptional
conversationConversationThe updated conversation after blocking the member✔️