removeAttributes method

Future<Map<String, int>?> removeAttributes(
  1. String roomId, {
  2. required List<String> keys,
  3. bool force = false,
})

~english Removes custom chat room attributes.

Param roomId The chat room ID.

Param keys The keys of the custom chat room attributes to remove.

Param force Whether to remove the attributes with same key set by others.

Return failureKeys map is returned in key-value format, where the key is the attribute key and the value is the reason for the failure.

Throws A description of the exception. See ChatError.

~end

~chinese 删除自定义聊天室属性。

Param roomId 聊天室 ID。

Param keys 要删除的自定义聊天室属性的键。

Param force 是否删除其他人设置的键值相同的属性。

Return 'failureKeys map'以键值格式返回,其中键是属性键,值是失败的原因。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError

~end

Implementation

Future<Map<String, int>?> removeAttributes(
  String roomId, {
  required List<String> keys,
  bool force = false,
}) async {
  Map req = {
    "roomId": roomId,
    "keys": keys,
    "forced": force,
  };

  Map result = await _channel.invokeMethod(
    ChatMethodKeys.removeChatRoomAttributes,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    return result[ChatMethodKeys.removeChatRoomAttributes]
        ?.cast<String, int>();
  } on ChatError catch (e) {
    throw e;
  }
}