blockChatRoomMembers method
~english Adds the specified members to the block list of the chat room.
Only the chat room owner or admin can call this method.
Note
- Chat room members added to the block list are removed from the chat room by the server, and cannot re-join the chat room.
- The removed members receive the ChatRoomEventHandler.onRemovedFromChatRoom callback.
Param roomId
The chat room ID.
Param members
The list of members to be added to block list.
Throws A description of the exception. See ChatError. ~end
~chinese 将成员添加到聊天室黑名单。
仅聊天室所有者和管理员可调用此方法。
对于添加到聊天室黑名单的成员,请注意以下几点:
- 成员添加到黑名单的同时,将被服务器移出聊天室。
- 可通过 ChatRoomEventHandler.onRemovedFromChatRoom 回调通知。
- 添加到黑名单的成员禁止再次加入到聊天室。
Param roomId
聊天室 ID。
Param members
要加入黑名单的成员列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<void> blockChatRoomMembers(
String roomId,
List<String> members,
) async {
Map req = {"roomId": roomId, "members": members};
Map result =
await _channel.invokeMethod(ChatMethodKeys.blockChatRoomMembers, req);
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}