> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-skills-v5-temp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Transfer Group Ownership

> Transfer CometChat group ownership to another member in Flutter apps before the current owner leaves the group.

<Accordion title="AI Integration Quick Reference">
  | Field          | Value                                                                                                                                                                                   |
  | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Package        | `cometchat_sdk`                                                                                                                                                                         |
  | Import         | `import 'package:cometchat_sdk/cometchat_sdk.dart';`                                                                                                                                    |
  | Purpose        | Transfer CometChat group ownership to another member in Flutter apps before the current owner leaves the group.                                                                         |
  | Key methods    | `transferGroupOwnership()`                                                                                                                                                              |
  | Key classes    | `CometChatException`                                                                                                                                                                    |
  | Prerequisites  | SDK initialised via [`CometChat.init()`](/sdk/flutter/setup) and a logged-in user via [`CometChat.login()`](/sdk/flutter/authentication-overview).                                      |
  | Constraints    | `onSuccess` and `onError` are **both required** — omitting either is a compile error, and awaiting the call alone gives you nothing to act on. Put the success path inside `onSuccess`. |
  | Related        | [Change Member Scope](/sdk/flutter/group-change-member-scope) · [Update A Group](/sdk/flutter/update-group)                                                                             |
  | Full reference | [`CometChatException`](/sdk/reference/auxiliary#cometchatexception)                                                                                                                     |
</Accordion>

*In other words, as a logged-in user, how do I transfer the ownership of any group if I am the owner of the group?*

In order to transfer the ownership of any group, the first condition is that you must be the owner of the group. In case you are the owner of the group, you can use the `transferGroupOwnership()` method provided by the `CometChat` class.

This will be helpful as the owner is not allowed to leave the group. In case, you as the owner would like to leave the group, you will have to use this method and transfer your ownership first to any other member of the group and only then you will be allowed to leave the group.

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