addUserToBlockList method

Future<void> addUserToBlockList(
  1. String userId
)

~english Adds a user to the block list. You can send messages to the users on the block list, but cannot receive messages from them.

Param userId The user to be added to the block list.

Throws A description of the exception. See ChatError. ~end

~chinese 将指定用户加入黑名单。 你可以向黑名单中用户发消息,但是接收不到对方发送的消息。

Param userId 要加入黑名单的用户的用户 ID。

Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 ChatError。 ~end

Implementation

Future<void> addUserToBlockList(
  String userId,
) async {
  Map req = {'username': userId};
  Map result = await _channel.invokeMethod(
    ChatMethodKeys.addUserToBlockList,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}