> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-angular-v5-docs-update.mintlify.site/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 title="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.
</Accordion>

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`](/sdk/reference/entities#group) object and the new owner by a [`User`](/sdk/reference/entities#user) object. See [Leave Group](/sdk/flutter/leave-group).

## Transfer Ownership

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

<Note>
  **Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview)
</Note>

<Tabs>
  <Tab title="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}");
            });  
    ```
  </Tab>
</Tabs>

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 title="Response">
  **On Success** — A `String` message confirming the ownership transfer:

  <span id="transfer-ownership-message" style={{scrollMarginTop: '100px'}} />

  | Parameter | Type   | Description                  | Sample Value                                            |
  | --------- | ------ | ---------------------------- | ------------------------------------------------------- |
  | `message` | string | Success confirmation message | `"cometchat-guid-1 ownership transferred successfully"` |
</Accordion>

<Accordion title="Error">
  <span id="transfer-ownership-error" style={{scrollMarginTop: '100px'}} />

  | 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."` |
</Accordion>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Leave Group" icon="right-from-bracket" href="/sdk/flutter/leave-group">
    Leave a group after transferring ownership
  </Card>

  <Card title="Change Member Scope" icon="user-gear" href="/sdk/flutter/group-change-member-scope">
    Promote or demote group members
  </Card>
</CardGroup>
