setChatRoomEntries static method

Future<void> setChatRoomEntries(
  1. String chatRoomId,
  2. Map<String, String> chatRoomEntryMap,
  3. bool autoRemove,
  4. bool overWrite,
  5. dynamic finished(
    1. int code,
    2. Map<String, int>? errors
    ),
)

批量设置聊天室自定义属性 chatRoomId 聊天室 ID chatRoomEntryMap 聊天室属性 1. chatRoomEntryMap集合大小最大限制为 10,超过限制返回错误码 23429 2. key 支持大小写英文字母、数字、部分特殊符号 + = - _ 的组合方式,最大长度 128 个字符 value 聊天室属性对应的值,最大长度 4096 个字符 autoRemove 用户掉线或退出时,是否自动删除该 Key、Value 值 overWrite 是否强制覆盖 finished 设置聊天室属性的回调 当 code 为 23428 的时候,errors 才会有值(key标识设置失败的 key,value 标识该 key 对应的错误码)

Implementation

static Future<void> setChatRoomEntries(
  String chatRoomId,
  Map<String, String> chatRoomEntryMap,
  bool autoRemove,
  bool overWrite,
  Function(int code, Map<String, int>? errors) finished,
) async {
  Map arguments = {
    "chatRoomId": chatRoomId,
    "chatRoomEntryMap": chatRoomEntryMap,
    "autoRemove": autoRemove,
    "overWrite": overWrite,
  };
  Map<dynamic, dynamic>? result = await _channel.invokeMapMethod(RCMethodKey.SetChatRoomEntries, arguments);
  if (result != null) {
    int code = result['code'];
    Map<dynamic, dynamic>? errors = result['errors'];
    if (errors != null) {
      finished(code, Map<String, int>.from(errors));
    } else {
      finished(code, null);
    }
  } else {
    finished(-1, null);
  }
}