> ## 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

> Transfer ownership of a CometChat group to another member using the Flutter SDK.

> [accordion] AI Integration Quick Reference
>
> ```dart theme={null}
> // 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`](https://www.cometchat.com/docs/sdk/reference/entities#group) object and the new owner by a [`User`](https://www.cometchat.com/docs/sdk/reference/entities#user) object. See [Leave Group](https://www.cometchat.com/docs/sdk/flutter/leave-group.md).

## Transfer Ownership

Use `transferGroupOwnership()` to transfer ownership to another group member.

> [!NOTE]
>
> **Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](https://www.cometchat.com/docs/ui-kit/flutter/overview.md)

> [tab] Dart
>
> ```dart theme={null}
> 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:

| Parameter | Type | Description |
| - | - | - |
| `guid` | `String` | The GUID of the group for which ownership needs to be transferred |
| `uid` | `String` | The UID of the member who should become the new owner |
| `onSuccess` | `Function(String)` | Callback triggered on successful ownership transfer |
| `onError` | `Function(CometChatException)` | Callback triggered on error |

On success, the new owner gets admin scope and the previous owner becomes a participant.

> [accordion] Response
>
> **On Success** — A `String` message confirming the ownership transfer:
>
> | Parameter | Type | Description | Sample Value |
> | - | - | - | - |
> | `message` | string | Success confirmation message | `"cometchat-guid-1 ownership transferred successfully"` |

> [accordion] Error
>
> | Parameter | Type | Description | Sample Value |
> | - | - | - | - |
> | `code` | string | Error code identifier | `"ERR_NOT_A_MEMBER"` |
> | `message` | string | Human-readable error message | `"The target user is not a member of the group."` |
> | `details` | string | Additional technical details | `"Ownership can only be transferred to an existing group member."` |

***

## Next Steps

> [card] [Leave Group](https://www.cometchat.com/docs/sdk/flutter/leave-group.md)
>
> Leave a group after transferring ownership

> [card] [Change Member Scope](https://www.cometchat.com/docs/sdk/flutter/group-change-member-scope.md)
>
> Promote or demote group members


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.