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

# Leave A Group

> Leave CometChat groups from Flutter apps by GUID and listen for real-time group member left events.

<Accordion title="AI Integration Quick Reference">
  | Field              | Value                                                                                                                                                                                                |
  | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Package            | `cometchat_sdk`                                                                                                                                                                                      |
  | Import             | `import 'package:cometchat_sdk/cometchat_sdk.dart';`                                                                                                                                                 |
  | Purpose            | Leave CometChat groups from Flutter apps by GUID and listen for real-time group member left events.                                                                                                  |
  | Key methods        | `addGroupListener()` · `leaveGroup()`                                                                                                                                                                |
  | Key classes        | `Group` · `Action` · `CometChatException` · `User`                                                                                                                                                   |
  | Listener callbacks | `onGroupMemberLeft()`                                                                                                                                                                                |
  | 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            | [Join A Group](/sdk/flutter/join-group) · [Ban/Kick Member From A Group](/sdk/flutter/group-kick-member)                                                                                             |
  | Full reference     | [`Group`](/sdk/reference/entities#group) · [`Action`](/sdk/reference/messages#action) · [`CometChatException`](/sdk/reference/auxiliary#cometchatexception) · [`User`](/sdk/reference/entities#user) |
</Accordion>

## Leave a Group

In order to stop receiving updates and messages for any particular joined group, you will have to leave the group using the `leaveGroup()` method.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    String GUID = "GUID";

    CometChat.leaveGroup(GUID, onSuccess: ( String message) {
          debugPrint("Group Left  Successfully : $message");
        },onError: (CometChatException e) {
          debugPrint("Group Left failed  : ${e.message}");
        }); 
    ```
  </Tab>
</Tabs>

| Parameter | Description                                   |
| --------- | --------------------------------------------- |
| `GUID`    | The GUID of the group you would like to leave |

Once a group is left, the user will no longer receive any updates or messages pertaining to the group.

## Real-time Group Member Left Events

*In other words, as a member of a group, how do I know if someone has left it when my app is running?*

If a user leaves a group, the members of the group receive a real-time event in the `onGroupMemberLeft()` method of the `GroupListener` class.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    class Class_Name  with GroupListener {

    //CometChat.addGroupListener("group_Listener_id", this);
    @override
    void onGroupMemberLeft(Action action, User leftUser, Group leftGroup) {
      print("onGroupMemberLeft ");

    }
    }
    ```
  </Tab>
</Tabs>

## Missed Group Member Left Events

*In other words, as a member of a group, how do I know if someone has left it when my app is not running?*

When you retrieve the list of previous messages if a member has left any group that the logged-in user is a member of, the list of messages will contain an `Action` message. An `Action` message is a sub-class of `BaseMessage` class.

For the group member left event, in the `Action` object received, the following fields can help you get the relevant information-

1. `action` - `left`
2. `actionBy` - User object containing the details of the user who left the group
3. `actionFor` - Group object containing the details of the group the user has left
