Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

// Transfer group ownership to another member
CometChat.transferGroupOwnership(
  guid: "GROUP_ID",
  uid: "NEW_OWNER_UID",
  onSuccess: (String message) => debugPrint("Ownership transferred: $message"),
  onError: (CometChatException e) => debugPrint("Error: ${e.message}"),
);
Note: Only the current group owner can transfer ownership. The owner must transfer ownership before leaving the group.
Transfer ownership of a group to another member. Only the current owner can do this, and since owners cannot leave their group, you must transfer ownership first if you want to leave. The group is represented by a Group object and the new owner by a User object. See Leave Group.

Transfer Ownership

Use transferGroupOwnership() to transfer ownership to another group member.
Available via: SDK | REST API | UI Kits
String UID = "cometchat-uid-1";
String GUID = conversationWith;
CometChat.transferGroupOwnership(guid: GUID,uid: UID,
        onSuccess: (String message) {
          debugPrint("Owner Transferred  Successfully : $message");
        },
        onError: (CometChatException e) {
          debugPrint("Owner Transferred failed  : ${e.message}");
        });  
This method takes the below parameters:
ParameterTypeDescription
guidStringThe GUID of the group for which ownership needs to be transferred
uidStringThe UID of the member who should become the new owner
onSuccessFunction(String)Callback triggered on successful ownership transfer
onErrorFunction(CometChatException)Callback triggered on error
On success, the new owner gets admin scope and the previous owner becomes a participant.
On Success — A String message confirming the ownership transfer:
ParameterTypeDescriptionSample Value
messagestringSuccess confirmation message"cometchat-guid-1 ownership transferred successfully"
ParameterTypeDescriptionSample Value
codestringError code identifier"ERR_NOT_A_MEMBER"
messagestringHuman-readable error message"The target user is not a member of the group."
detailsstringAdditional technical details"Ownership can only be transferred to an existing group member."

Next Steps

Leave Group

Leave a group after transferring ownership

Change Member Scope

Promote or demote group members