removeAttributes method

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

删除自定义聊天室属性。

Param roomId 聊天室 ID。

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

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

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

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

Implementation

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

    Map result = await platform_interface.Client.instance.chatRoomManager.callNativeMethod(
      ChatMethodKeys.removeChatRoomAttributes,
      req,
    );
    ChatError.hasErrorFromResult(result);
    return result[ChatMethodKeys.removeChatRoomAttributes]
        ?.cast<String, int>();
  } catch (e) {
    rethrow;
  }
}