createGroup method

Future<V2TimValueCallback<String>> createGroup({
  1. String? groupID,
  2. required String groupType,
  3. required String groupName,
  4. String? notification,
  5. String? introduction,
  6. String? faceUrl,
  7. bool? isAllMuted,
  8. bool? isSupportTopic = false,
  9. GroupAddOptTypeEnum? addOpt,
  10. List<V2TimGroupMember>? memberList,
  11. GroupAddOptTypeEnum? approveOpt,
  12. bool? isEnablePermissionGroup,
  13. int? defaultPermissions,
})

创建自定义群组(高级版本:可以指定初始的群成员)

参数

info	自定义群组信息,可以设置 groupID | groupType | groupName | notification | introduction | faceURL 字段
memberList	指定初始的群成员(直播群 AVChatRoom 不支持指定初始群成员,memberList 请传 null)

注意

其他限制请参考V2TIMManager.createGroup注释
isSupportTopic 仅对社群有效

Implementation

Future<V2TimValueCallback<String>> createGroup({
  String? groupID,
  required String groupType,
  required String groupName,
  String? notification,
  String? introduction,
  String? faceUrl,
  bool? isAllMuted,
  bool? isSupportTopic = false,
  GroupAddOptTypeEnum? addOpt,
  List<V2TimGroupMember>? memberList,
  GroupAddOptTypeEnum? approveOpt,
  bool? isEnablePermissionGroup,
  int? defaultPermissions,
}) async {
  // add a default number.
  GroupAddOptTypeEnum addOptDefault = addOpt == null
      ? GroupAddOptTypeEnum.V2TIM_GROUP_ADD_ANY
      : (groupType == GroupType.AVChatRoom
          ? GroupAddOptTypeEnum.V2TIM_GROUP_ADD_ANY
          : addOpt);
  GroupAddOptTypeEnum approveOptDefault = approveOpt == null
      ? GroupAddOptTypeEnum.V2TIM_GROUP_ADD_FORBID
      : (groupType == GroupType.AVChatRoom
          ? GroupAddOptTypeEnum.V2TIM_GROUP_ADD_FORBID
          : approveOpt);
  return TencentCloudChatSdkPlatform.instance.createGroup(
    groupType: groupType,
    groupName: groupName,
    groupID: groupID,
    notification: notification,
    introduction: introduction,
    faceUrl: faceUrl,
    isAllMuted: isAllMuted,
    addOpt: addOptDefault.index,
    memberList: memberList,
    isSupportTopic: isSupportTopic,
    approveOpt: approveOptDefault.index,
    isEnablePermissionGroup:isEnablePermissionGroup,
    defaultPermissions: defaultPermissions,
  );
}