addUserToBlackList method

void addUserToBlackList ({String userName, bool both: false, dynamic onSuccess(), dynamic onError(int code, String desc) })

把指定用户加入到黑名单中 userName . 如果both设置为true,则双方都无法向对方发送消息。否则,userName仍然可以接收消息。 如果加入成功,请调用onSuccess,如果出现错误,请调用onError

Implementation

void addUserToBlackList(
    {String userName,
    bool both = false,
    onSuccess(),
    onError(int code, String desc)}) {
  Future<Map> result = _emContactManagerChannel.invokeMethod(
      EMSDKMethod.addUserToBlackList, {"userName": userName, "both": both});
  result.then((response) {
    if (response["success"]) {
      if (onSuccess != null) onSuccess();
    } else {
      if (onError != null) onError(response['code'], response['desc']);
    }
  });
}