### CometChatHelper() Source: https://pub.dev/documentation/cometchat_sdk/latest/helpers_cometchat_helper/CometChatHelper/CometChatHelper.html Initializes a new instance of the CometChatHelper class. This is the primary way to get started with the CometChat helper functionalities. ```APIDOC ## CometChatHelper() ### Description Initializes a new instance of the CometChatHelper class. ### Method Constructor ### Parameters None ### Request Example ```javascript const cometChatHelper = new CometChatHelper(); ``` ### Response - **CometChatHelper** (object) - An instance of the CometChatHelper. ``` -------------------------------- ### startTyping Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Informs the receiver that the logged-in user has started typing. ```APIDOC ## startTyping ### Description Method to inform the receiver that the logged in user has started typing. ### Method Signature `startTyping({required String receiverUid, required String receiverType})` ### Parameters * **receiverUid** (String) - The unique ID of the receiver. * **receiverType** (String) - The type of the receiver (e.g., 'user', 'group'). ``` -------------------------------- ### createGroupWithMembers Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Creates a new group and simultaneously adds initial members to it. This is a convenient way to set up a group with its starting participants. ```APIDOC ## createGroupWithMembers ### Description Creates a group in CometChat along with initial members and returns the created Group. ### Method Signature `createGroupWithMembers({required Group group, required List groupMembers, List bannedUserIds = const [], dynamic onSuccess(Group group)?, dynamic onError(CometChatException excep)?})` ### Parameters - **group** (Group) - Required - A `Group` object containing the details of the group to be created. - **groupMembers** (List) - Required - A list of `GroupMember` objects to be added to the group upon creation. - **bannedUserIds** (List) - Optional - A list of user IDs to be banned from the group upon creation. Defaults to an empty list. - **onSuccess** (Function) - Optional - Callback function executed upon successful group creation and member addition. It receives the created `Group` object. - **onError** (Function) - Optional - Callback function executed if an error occurs. It receives a `CometChatException` object. ### Returns - A `Future` representing the created group. ``` -------------------------------- ### UserPresence copyWith Example Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/UserPresence/copyWith.html Demonstrates how to use the copyWith method to create an updated UserPresence object with a new status. ```dart final updated = presence.copyWith(status: 'offline'); ``` -------------------------------- ### build() Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_app_settings_request/AppSettingsBuilder-class.html Builds and returns an AppSettings object with the configured settings. ```APIDOC ## build() ### Description Builds and returns an `AppSettings` object. ### Method `build()` ### Returns `AppSettings` - The configured AppSettings object. ``` -------------------------------- ### Example Usage of copyWith Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/CCExtension/copyWith.html Demonstrates how to use the copyWith method to create an updated instance of CCExtension with a new extension name. ```dart final updated = extension.copyWith(extensionName: 'New Name'); ``` -------------------------------- ### Get Group ID using getGuid Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_banned_group_member_request/BannedGroupMembersRequest/getGuid.html This method returns the group's unique identifier. It is a simple getter for the 'guid' property. ```dart String getGuid() => guid; ``` -------------------------------- ### startTyping static method Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/startTyping.html This method informs the receiver that the logged-in user has started typing. It uses the RealtimeRepository to send typing indicators via WebSocket. The behavior and signature are identical to the previous platform channel implementation for backward compatibility. ```APIDOC ## startTyping ### Description This method is used to inform the receiver that the logged-in user has started typing. The receiver will get this information in the `onTypingStarted()` method of the `MessageListener` class. ### Method Signature `dynamic startTyping({required String receiverUid, required String receiverType})` ### Parameters #### Path Parameters * **receiverUid** (String) - Required - The unique ID of the receiver. * **receiverType** (String) - Required - The type of the receiver (e.g., `CometChat.RECEIVER_TYPE.user` or `CometChat.RECEIVER_TYPE.group`). ### Migration Note Migrated from platform channels to native Dart implementation. Uses `RealtimeRepository` for sending typing indicators via WebSocket. Behavior and signature remain identical for backward compatibility. ### Android Reference `CometChat.startTyping()` ``` -------------------------------- ### build method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_app_settings_request/AppSettingsBuilder/build.html Builds and returns an AppSettings object. ```APIDOC ## build method ### Description Builds and returns an `AppSettings` object. ### Signature `AppSettings build()` ### Implementation ```dart AppSettings build() { return AppSettings._builder(this); } ``` ``` -------------------------------- ### Get Group ID - Dart Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_messages_request/MessagesRequest/getGUID.html Use this method to retrieve the group ID associated with a message request. It directly returns the value of the internal guid property. ```dart String? getGUID() => guid; ``` -------------------------------- ### Reaction Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/Reaction-class.html Provides information on how to create new Reaction instances. ```APIDOC ## Constructors ### Reaction ```dart Reaction({String? id, int? messageId, String? reaction, String? uid, int? reactedAt, User? reactedBy}) ``` Constructs a new `Reaction` instance. ### Reaction.fromMap ```dart Reaction.fromMap(dynamic map) ``` Creates a new `Reaction` instance from a map. ``` -------------------------------- ### GUID Property Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_group_members_request/GroupMembersRequest/guid.html The guid property is a final String that specifies the Group ID for fetching group members. ```APIDOC ## guid property ### Description String guid Group ID for the group whose members are to be fetched. ### Implementation ``` final String guid; ``` ``` -------------------------------- ### connect static method Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/connect.html Establishes WebSocket connections manually. Use this when you need to manage the WebSocket connection yourself instead of relying on auto-establishment. ```APIDOC ## connect static method ### Description Establishes the WebSocket connections manually. While calling the init() function on the app startup, need to inform the SDK that you will be managing the web socket connect from autoEstablishSocketConnection. Once the connection is established, you will start receiving all the real-time events for the logged in user. ### Method Signature `static Future connect({Function(String successMessage)? onSuccess, Function(CometChatException e)? onError})` ### Parameters - **onSuccess** (Function(String successMessage)?) - Optional - Callback function that is invoked when the WebSocket connection is successfully established. It receives a success message string. - **onError** (Function(CometChatException e)?) - Optional - Callback function that is invoked if an error occurs during the WebSocket connection establishment. It receives a CometChatException object detailing the error. ### Implementation Details This method internally uses the `SdkRegistry` to get the SDK instance and then calls the `connect()` method on the `realtime` object to establish the WebSocket connection. Error handling is included to convert `SdkException` to `CometChatException` and invoke the respective callbacks. ``` -------------------------------- ### Declare guid Property Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_banned_group_member_request/BannedGroupMembersRequest/guid.html This snippet shows the declaration of the final String guid property, which holds the Group ID. ```dart final String guid; ``` -------------------------------- ### init Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Initializes the CometChat SDK with the provided App ID and settings. ```APIDOC ## init ### Description Initializes the CometChat SDK with the provided App ID and settings. ### Parameters #### Path Parameters - **appId** (String) - Required - Your CometChat App ID. - **appSettings** (AppSettings) - Required - Settings for the CometChat SDK. #### Query Parameters - **onSuccess** (dynamic) - Optional - Callback function for successful initialization. - **onError** (dynamic) - Optional - Callback function for errors during initialization. ### Returns - Future ``` -------------------------------- ### getOnlineGroupMemberCount Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get the total count of online users in particular groups. Get online member count for multiple groups. ```APIDOC ## getOnlineGroupMemberCount ### Description Get the total count of online users in particular groups. Get online member count for multiple groups. ### Parameters #### Path Parameters - **guids** (List) - Required - A list of group IDs. #### Query Parameters - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future?> - A future that resolves to a map of group IDs to online member counts or null. ``` -------------------------------- ### Get Conversation Type Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_conversations_request/ConversationsRequest/getConversationType.html Retrieves the conversation type filter. Use this method to get the current conversation type setting. ```dart String? getConversationType() => conversationType; ``` -------------------------------- ### Initialize Reaction Instance Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/Reaction/Reaction.html Constructs a new `Reaction` instance. All parameters are optional. ```dart Reaction( {this.id, this.messageId, this.reaction, this.uid, this.reactedAt, this.reactedBy}); ``` -------------------------------- ### Define errorInvalidGuid Constant Source: https://pub.dev/documentation/cometchat_sdk/latest/utils_constants/ErrorCode/errorInvalidGuid-constant.html This constant defines the error code for an invalid GUID. Use this string value when handling GUID validation errors. ```javascript static const errorInvalidGuid = "ERROR_INVALID_GUID"; ``` -------------------------------- ### MessagesRequestBuilder guid Property Declaration Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_messages_request/MessagesRequestBuilder/guid.html Declares the guid property as a nullable String. This property is used to specify the Group ID for fetching messages. ```dart String? guid; ``` -------------------------------- ### Initialize SDK with Logger Configuration Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/LoggerConfig-class.html Configure SDK logging by passing a LoggerConfig instance to AppSettingsBuilder.setLoggerConfig(). This example enables the master logger and specific layers. ```dart final settings = (AppSettingsBuilder() ..setRegion('us') ..setLoggerConfig(LoggerConfig( enableLogger: true, enableSocketLogs: true, enableRepositoryLogs: true, ))) .build(); ``` -------------------------------- ### Initialize CometChat SDK Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/init.html Call this static method on app startup to initialize the CometChat SDK. It requires your App ID and AppSettings. Success and error callbacks can be provided. ```dart static Future init(String appId, AppSettings appSettings, {required Function(String successMessage)? onSuccess, required Function(CometChatException e)? onError}) async { // Initialize native Dart SDK await SdkInitializer.initialize( appId, appSettings, onSuccess: (message) { // Set up native Dart stream subscriptions for real-time events _setupNativeStreamSubscriptions(); Logger.info('CometChat', 'SDK initialized successfully with native Dart implementation'); if (onSuccess != null) onSuccess(message); }, onError: onError, ); } ``` -------------------------------- ### guid Property Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_group_members_request/GroupMembersRequestBuilder/guid.html The guid property is a String that serves as a getter/setter pair for the Group ID. This ID is used to identify the group for which members are to be fetched. ```APIDOC ## guid Property ### Description String guid getter/setter pair Group ID for the group whose members are to be fetched. ### Implementation ```java String guid; ``` ``` -------------------------------- ### Operator == Implementation Example Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/CCExtension/operator_equals.html Provides an example implementation of the operator == method for a CometChat extension, comparing extensionId and extensionName for equality. ```APIDOC ## Implementation ```dart @override bool operator ==(Object other) => identical(this, other) || other is CCExtension && runtimeType == other.runtimeType && extensionId == other.extensionId && extensionName == other.extensionName; ``` ``` -------------------------------- ### FlagReason Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/FlagReason-class.html Provides information on how to instantiate a FlagReason object. ```APIDOC ## Constructors FlagReason({required String id, required String name, String? description, DateTime? createdAt, DateTime? updatedAt}) Constructs a new FlagReason instance. FlagReason.fromMap(dynamic map) Creates a new FlagReason instance from a map. factory ``` -------------------------------- ### Declare guid Property Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_messages_request/MessagesRequest/guid.html This snippet shows the declaration of the guid property, which is a nullable String used to identify the group for fetching messages. It is marked as final. ```dart final String? guid; ``` -------------------------------- ### Create Group Implementation Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/createGroup.html This snippet shows the implementation of the `createGroup` static method. It handles SDK instantiation, calls the group creation repository, and manages success and error callbacks. ```dart static Future createGroup( {required Group group, required Function(Group group)? onSuccess, required Function(CometChatException excep)? onError}) async { try { // Get SDK instance final sdk = SdkRegistry.getInstance(); // Call repository final createdGroup = await sdk.groups.createGroup(group); // Call success callback if (onSuccess != null) onSuccess(createdGroup); return createdGroup; } on SdkException catch (sdkEx) { // Convert SdkException to CometChatException final cometChatEx = CometChatException( sdkEx.code, sdkEx.details ?? sdkEx.message, sdkEx.message, ); _errorCallbackHandler(cometChatEx, null, null, onError); } catch (e) { // Handle unexpected errors _errorCallbackHandler(null, null, e, onError); } return null; } ``` -------------------------------- ### Building the UsersRequest Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_users_request/UsersRequestBuilder-class.html Demonstrates how to finalize the request construction and obtain the UsersRequest object. ```APIDOC ## build() ### Description Builds and returns an `UsersRequest` object based on the configured parameters. ### Method `build() → UsersRequest` ``` -------------------------------- ### getGroup Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Gets group details. ```APIDOC ## getGroup ### Description Gets group details. ### Parameters #### Path Parameters - **guid** (String) - Required - The unique identifier of the group. #### Query Parameters - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future - A future that resolves to the Group object or null. ``` -------------------------------- ### init static method Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/init.html Initializes the settings required for CometChat. It is suggested to call this method on app startup. `appId` refers to your CometChat App ID. The `region` parameter specifies the region where the app was created. ```APIDOC ## init static method ### Description Initializes the settings required for CometChat. We suggest you call the init() method on app startup. `appId` refers to your CometChat App ID. region The region where the app was created. ### Method Signature Future init( 1. String appId, 2. AppSettings appSettings, { 3. required dynamic onSuccess( String successMessage)?, 4. required dynamic onError( CometChatException e)?, }) ### Parameters #### Path Parameters - **appId** (String) - Required - Your CometChat App ID. - **appSettings** (AppSettings) - Required - Settings for the CometChat application. #### Optional Parameters - **onSuccess** (Function(String)) - Optional - Callback function to be executed upon successful initialization. - **onError** (Function(CometChatException)) - Optional - Callback function to be executed if an error occurs during initialization. ``` -------------------------------- ### Get Conversation Starters Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/getConversationStarter.html Use this method to get AI-generated conversation starter suggestions for a user or group. Ensure receiverId and receiverType are valid. Handles potential SDK exceptions and general errors by invoking the onError callback. ```dart static Future getConversationStarter( String receiverId, String receiverType, {Map? configuration, required Function(List conversationStarters) onSuccess, required Function(CometChatException e) onError}) async { try { // Validate parameters if (receiverId.isEmpty) { onError(CometChatException( ErrorCode.errorInvalidReceiverId, ErrorMessage.errorMessageInvalidReceiverId, ErrorMessage.errorMessageInvalidReceiverId)); return; } if (receiverType.isEmpty) { onError(CometChatException( ErrorCode.errorInvalidReceiverType, ErrorMessage.errorMessageInvalidReceiverType, ErrorMessage.errorMessageInvalidReceiverType)); return; } // Get SDK instance final sdk = SdkRegistry.getInstance(); // Call native Dart AI repository final starters = await sdk.ai.getConversationStarter(receiverId, receiverType); // Call success callback onSuccess(starters); } on SdkException catch (sdkEx) { // Convert SdkException to CometChatException final cometChatEx = CometChatException( sdkEx.code, sdkEx.details ?? sdkEx.message, sdkEx.message, ); onError(cometChatEx); } catch (e) { onError(CometChatException( ErrorCode.errorUnhandledException, e.toString(), e.toString(), )); } } ``` -------------------------------- ### Get Total File Size of Media Message Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/MediaMessage/getTotalFileSize.html Instantiate a MediaMessage with attachments and then call `getTotalFileSize()` to get the sum of all attachment file sizes in bytes. Returns 0 if no attachments are present or if all attachment file sizes are null. ```dart final message = MediaMessage( receiverUid: 'user-123', type: 'file', receiverType: 'user', attachments: [ Attachment('url1', 'file1.pdf', 'pdf', 'application/pdf', 1000), Attachment('url2', 'file2.pdf', 'pdf', 'application/pdf', 2000), ], ); print(message.getTotalFileSize()); // 3000 ``` -------------------------------- ### CometChatWSState() Source: https://pub.dev/documentation/cometchat_sdk/latest/utils_constants/CometChatWSState/CometChatWSState.html Initializes a new instance of the CometChatWSState class. This constructor does not require any arguments. ```APIDOC ## CometChatWSState() ### Description Initializes a new instance of the CometChatWSState class. This constructor is used to set up the WebSocket state management for CometChat. ### Method constructor ### Parameters This constructor does not accept any parameters. ### Request Example ```javascript const wsState = new CometChatWSState(); ``` ### Response This constructor does not return a value, but it initializes the CometChatWSState object. ``` -------------------------------- ### Implement onTypingStarted Callback Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_message_listener/MessageListener/onTypingStarted.html This is the basic implementation of the onTypingStarted callback. It is triggered when a user begins typing and receives a TypingIndicator object. ```dart void onTypingStarted(TypingIndicator typingIndicator) {} ``` -------------------------------- ### getMessageReceipts Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Method to get message receipts. ```APIDOC ## getMessageReceipts ### Description Method to get message receipts. ### Parameters #### Path Parameters - **messageId** (int) - Required - The ID of the message. #### Query Parameters - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future?> - A future that resolves to a list of MessageReceipt objects or null. ``` -------------------------------- ### getConversationSummary Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get AI-generated summary of a conversation. ```APIDOC ## getConversationSummary ### Description Get AI-generated summary of a conversation. ### Parameters #### Path Parameters - **receiverId** (String) - Required - The ID of the receiver. - **receiverType** (String) - Required - The type of the receiver ('user' or 'group'). #### Query Parameters - **configuration** (Map?) - Optional - Additional configuration map. - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future ``` -------------------------------- ### Reaction Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/Reaction/Reaction.html Constructs a new `Reaction` instance with optional parameters. ```APIDOC ## Reaction Constructor ### Description Constructs a new `Reaction` instance. ### Parameters - **id** (String?) - Optional - The unique identifier for the reaction. - **messageId** (int?) - Optional - The ID of the message the reaction is associated with. - **reaction** (String?) - Optional - The type of reaction (e.g., emoji). - **uid** (String?) - Optional - The user ID of the person who reacted. - **reactedAt** (int?) - Optional - The timestamp when the reaction occurred. - **reactedBy** (User?) - Optional - The user object of the person who reacted. ### Implementation ```dart Reaction({ this.id, this.messageId, this.reaction, this.uid, this.reactedAt, this.reactedBy }); ``` ``` -------------------------------- ### getLastDeliveredMessageId Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get the last delivered message ID. ```APIDOC ## getLastDeliveredMessageId ### Description Get last delivered message ID. ### Parameters #### Query Parameters - **onSuccess** (dynamic) - Optional - Callback function for successful retrieval. ### Returns - Future - A future that resolves to the last delivered message ID or null. ``` -------------------------------- ### User Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/User/User.html Constructs a new `User` instance. Requires `uid` and `name` to be specified. Other properties are optional. ```APIDOC ## User Constructor ### Description Constructs a new `User` instance. ### Parameters - **uid** (String) - Optional - User's unique identifier. - **name** (String) - Required - User's name. - **avatar** (String?) - Optional - URL of the user's avatar. - **link** (String?) - Optional - Link associated with the user. - **role** (String?) - Optional - User's role. - **status** (String?) - Optional - User's current status (e.g., 'online', 'offline'). - **statusMessage** (String?) - Optional - A message associated with the user's status. - **lastActiveAt** (DateTime?) - Optional - Timestamp of the user's last active time. - **tags** (List?) - Optional - List of tags associated with the user. - **metadata** (Map?) - Optional - Custom metadata for the user. - **hasBlockedMe** (bool?) - Optional - Indicates if the user has blocked the current user. - **blockedByMe** (bool?) - Optional - Indicates if the current user has blocked this user. - **deactivatedAt** (DateTime?) - Optional - Timestamp when the user was deactivated. ### Implementation ```dart User({ this.uid = "", required this.name, this.avatar, this.link, this.role, this.status, this.statusMessage, this.lastActiveAt, this.tags, this.metadata, this.hasBlockedMe, this.blockedByMe, this.deactivatedAt, }); ``` ``` -------------------------------- ### getConversationStarter Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get AI-generated conversation starter suggestions. ```APIDOC ## getConversationStarter ### Description Get AI-generated conversation starter suggestions. ### Parameters #### Path Parameters - **receiverId** (String) - Required - The ID of the receiver. - **receiverType** (String) - Required - The type of the receiver ('user' or 'group'). #### Query Parameters - **configuration** (Map?) - Optional - Additional configuration map. - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future ``` -------------------------------- ### initiateCall static method Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/initiateCall.html Initiates a call to a user or group. It takes a Call object and callback functions for success and error handling. ```APIDOC ## initiateCall static method ### Description Initiates a call to a user or group. ### Method Signature `void initiateCall(Call call, {required Function(Call call)? onSuccess, required Function(CometChatException excep) onError})` ### Parameters - **call** (Call) - Required - An object containing call details like receiver UID, receiver type, and call type. - **onSuccess** (Function(Call call)?) - Optional - Callback function executed upon successful call initiation. It receives the initiated `Call` object. - **onError** (Function(CometChatException excep)) - Required - Callback function executed if an error occurs during call initiation. It receives a `CometChatException` object. ### Android Reference `CometChat.initiateCall(Call call, CallbackListener)` ### Response Parsing Details Response parsing uses `Call.fromMap()` to match Android SDK's `Call.fromJson()`: * `sessionId` from `data.entities.on.entity.sessionid` * `callInitiator` from `data.entities.on.entity.data.entities.sender` * `callReceiver` from `data.entities.on.entity.data.entities.receiver` * `sender` from `data.entities.by.entity` * `receiver` from `data.entities.for.entity ``` -------------------------------- ### getConnectionStatus Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get the current WebSocket connection status. ```APIDOC ## getConnectionStatus ### Description Get the current WebSocket connection status. ### Returns - Future - A future that resolves to the connection status string. ``` -------------------------------- ### connect Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Manually establishes the WebSocket connections required for real-time communication. Use this if you need to control the connection lifecycle explicitly. ```APIDOC ## connect ### Description Establishes the WebSocket connections manually. ### Method Signature `connect({dynamic onSuccess(String successMessage)?, dynamic onError(CometChatException e)?})` ### Parameters - **onSuccess** (Function) - Optional - Callback function executed upon successful connection establishment. It receives a success message. - **onError** (Function) - Optional - Callback function executed if an error occurs during connection. It receives a `CometChatException` object. ### Returns - A `Future`. ``` -------------------------------- ### getActiveCall Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Gets the currently active call session. ```APIDOC ## getActiveCall ### Description Gets the currently active call session. ### Returns - Future - A future that resolves to the active Call object or null if no active call. ``` -------------------------------- ### Get Online Group Member Count Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/getOnlineGroupMemberCount.html Use this method to get the total count of online users in particular groups. It takes a list of group IDs and provides callbacks for success and error handling. Migrated from platform channels to native Dart implementation. ```dart static Future?> getOnlineGroupMemberCount(List guids, {required Function(Map result)? onSuccess, required Function(CometChatException excep)? onError}) async { try { // Get SDK instance final sdk = SdkRegistry.getInstance(); // Call native Dart presence repository // **Android Reference:** Uses same endpoint as getOnlineUserCount with groups body final result = await sdk.presence.getOnlineGroupMemberCount(guids); // Call success callback if (onSuccess != null) onSuccess(result); return result; } on SdkException catch (sdkEx) { // Convert SdkException to CometChatException final cometChatEx = CometChatException( sdkEx.code, sdkEx.details ?? sdkEx.message, sdkEx.message, ); _errorCallbackHandler(cometChatEx, null, null, onError); } catch (e) { _errorCallbackHandler(null, null, e, onError); } return null; } ``` -------------------------------- ### getUserAuthToken Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get the current user's auth token. ```APIDOC ## getUserAuthToken ### Description Get the current user's auth token. ### Returns - Future - A future that resolves to the user's auth token or null. ``` -------------------------------- ### AppSettingsBuilder() Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_app_settings_request/AppSettingsBuilder/AppSettingsBuilder.html Default constructor for `AppSettingsBuilder`. Initializes the builder with default settings. ```APIDOC ## AppSettingsBuilder() ### Description Default constructor for `AppSettingsBuilder`. ### Implementation ```dart AppSettingsBuilder(); ``` ``` -------------------------------- ### onTypingStarted Method Signature Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_message_listener/MessageListener/onTypingStarted.html The onTypingStarted method is called when a user begins typing. It accepts a TypingIndicator object as a parameter. ```APIDOC ## onTypingStarted ### Description This method is invoked when a user starts typing in a chat. It provides information about the typing indicator. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **typingIndicator** (TypingIndicator) - Required - An object containing details about the typing indicator. ``` -------------------------------- ### getSmartReplies Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get AI-generated smart reply suggestions for a conversation. ```APIDOC ## getSmartReplies ### Description Get AI-generated smart reply suggestions for a conversation. ### Parameters #### Path Parameters - **receiverId** (String) - Required - The ID of the receiver. - **receiverType** (String) - Required - The type of the receiver ('user' or 'group'). #### Query Parameters - **configuration** (Map?) - Optional - Additional configuration map. - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future ``` -------------------------------- ### getOnlineUserCount Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Get the total count of online users for your app. ```APIDOC ## getOnlineUserCount ### Description Get the total count of online users for your app. ### Parameters #### Query Parameters - **onSuccess** (dynamic) - Required - Callback function for successful retrieval. - **onError** (dynamic) - Required - Callback function for errors during retrieval. ### Returns - Future - A future that resolves to the total online user count or null. ``` -------------------------------- ### User Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/User-class.html Provides constructors for creating User instances. ```APIDOC ## Constructors User({String uid = "", required String name, String? avatar, String? link, String? role, String? status, String? statusMessage, DateTime? lastActiveAt, List? tags, Map? metadata, bool? hasBlockedMe, bool? blockedByMe, DateTime? deactivatedAt}) Constructs a new `User` instance. User.fromMap(dynamic map) Creates a new `User` instance from a map. factory User.fromUID({required String uid, required String name, String? avatar = '', String? link = '', String? role = 'default', String? status = 'offline', String? statusMessage = '', DateTime? lastActiveAt, List? tags = const [], Map? metadata = const {}, bool? hasBlockedMe = false, bool? blockedByMe = false, DateTime? deactivatedAt}) Constructs a new `User` instance from a provided UID. ``` -------------------------------- ### ReactionAction Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/utils_constants/ReactionAction/ReactionAction.html Initializes a new instance of the ReactionAction class. ```APIDOC ## ReactionAction Constructor ### Description Initializes a new instance of the ReactionAction class. ### Signature ReactionAction() ### Parameters This constructor does not take any parameters. ``` -------------------------------- ### Get Timezone Source: https://pub.dev/documentation/cometchat_sdk/latest/notification_main_cometchat_notifications/CometChatNotifications-class.html Retrieves the timezone preference for the logged-in user. ```APIDOC ## getTimezone ### Description Retrieves the timezone preference for the logged-in user. ### Method `Future getTimezone({dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?})` ### Parameters - `onSuccess` (Function) - Optional callback function that is executed upon successful retrieval of the timezone. - `onError` (Function) - Optional callback function that is executed if an error occurs during retrieval. ``` -------------------------------- ### onConnecting Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_connection_listener/ConnectionListener/onConnecting.html This method is called when the SDK is attempting to establish a connection. It's a void method with no parameters. ```APIDOC ## onConnecting ### Description This method is invoked when the connection process begins. It serves as a notification hook for connection attempts. ### Signature `void onConnecting()` ### Implementation Example ```dart void onConnecting() { // Handle connection starting logic here } ``` ``` -------------------------------- ### hashCode Property Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_event_handler/EventHandler-class.html Gets the hash code for the EventHandler object. ```APIDOC ## hashCode → int ### Description The hash code for this object. ### Property hashCode ``` -------------------------------- ### getUserStatus Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_users_request/UsersRequest/getUserStatus.html Gets the status filter used to fetch users. ```APIDOC ## getUserStatus method ### Description Gets the status filter used to fetch users. ### Signature String? getUserStatus() ### Implementation ```dart String? getUserStatus() => userStatus; ``` ``` -------------------------------- ### AppSettings Methods Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_app_settings_request/AppSettings-class.html Methods available in the AppSettings class. ```APIDOC ## AppSettings Methods - **getAdminHost()** → String?: Gets the admin host URL. - **getClientHost()** → String?: Gets the client host URL. - **getIsAutoJoinEnabled()** → bool: Checks if auto join is enabled (deprecated). - **getRegion()** → String?: Gets the region. - **getRoles()** → List?: Gets the roles for presence subscription. - **getSubscriptionType()** → String?: Gets the subscription type. - **isAutoSocketConnectionEnabled()** → bool: Checks if socket connection should be auto-established. - **shouldAutoEstablishSocketConnection()** → bool: Checks if socket connection should be auto-established (deprecated). ``` -------------------------------- ### getSortOrder Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_users_request/UsersRequest/getSortOrder.html Gets the order in which the user list is sorted. ```APIDOC ## getSortOrder Method ### Description Gets the order in which the user list is sorted. ### Signature String? getSortOrder() ### Implementation Example ```dart String? getSortOrder() => sortByOrder; ``` ``` -------------------------------- ### CometChatMemberScope() Source: https://pub.dev/documentation/cometchat_sdk/latest/utils_constants/CometChatMemberScope/CometChatMemberScope.html Initializes a new instance of the CometChatMemberScope class. This constructor does not require any arguments. ```APIDOC ## CometChatMemberScope() ### Description Initializes a new instance of the CometChatMemberScope class. ### Method constructor ### Parameters This constructor does not accept any parameters. ### Request Example ```javascript const memberScope = new CometChatMemberScope(); ``` ### Response Returns an instance of CometChatMemberScope. ``` -------------------------------- ### ReactionEvent Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/notification_models_reaction_event/ReactionEvent-class.html Provides information on how to create instances of the ReactionEvent class. ```APIDOC ## Constructors `ReactionEvent({Reaction? reaction, String? receiverId, String? receiverType, String? conversationId, int? parentMessageId})` `ReactionEvent.fromMap(dynamic map)` ``` -------------------------------- ### getLimit Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_users_request/UsersRequest/getLimit.html Gets the limit on the number of users to be fetched. ```APIDOC ## getLimit Method ### Description Gets the limit on the number of users to be fetched. ### Signature `int getLimit()` ### Implementation ```dart int getLimit() => limit; ``` ``` -------------------------------- ### getMessageId Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_reaction_request/ReactionsRequest/getMessageId.html Gets the message ID for which reactions are to be fetched. ```APIDOC ## getMessageId Method ### Description Gets the message ID for which reactions are to be fetched. ### Signature `int getMessageId()` ### Implementation ```dart int getMessageId() => messageId; ``` ``` -------------------------------- ### Load pubspec.yaml Content Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat/loadPubspecYaml.html Use this static method to asynchronously load the pubspec.yaml file content as a string. Ensure that the 'pubspec.yaml' file is present in the project's root directory. ```dart static Future loadPubspecYaml() async { String yamlString = await rootBundle.loadString('pubspec.yaml'); return yamlString; } ``` -------------------------------- ### CometChatSubscriptionType Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/utils_constants/CometChatSubscriptionType/CometChatSubscriptionType.html Initializes a new instance of the CometChatSubscriptionType class. This constructor does not require any arguments. ```APIDOC ## CometChatSubscriptionType() ### Description Initializes a new instance of the CometChatSubscriptionType class. ### Method constructor ### Parameters This constructor does not accept any parameters. ### Request Example ```javascript const subscriptionType = new CometChatSubscriptionType(); ``` ### Response This constructor does not return a value, but initializes an object of type CometChatSubscriptionType. ``` -------------------------------- ### getLimit Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_groups_request/GroupsRequest/getLimit.html Gets the limit on the number of groups to be fetched. ```APIDOC ## getLimit Method ### Description Gets the limit on the number of groups to be fetched. ### Signature `int getLimit()` ### Implementation ```dart int getLimit() => limit; ``` ``` -------------------------------- ### getDirection Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_blocked_users_request/BlockedUsersRequest/getDirection.html Gets the direction type for blocked users. ```APIDOC ## getDirection Method ### Description Gets the direction type for blocked users. ### Signature `String getDirection()` ### Implementation ```dart String getDirection() => direction; ``` ``` -------------------------------- ### AIAssistantToolStartedEvent Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/AIAssistantToolStartedEvent/AIAssistantToolStartedEvent.html Initializes a new instance of the AIAssistantToolStartedEvent class with optional parameters. ```APIDOC ## AIAssistantToolStartedEvent Constructor ### Description Initializes a new instance of the AIAssistantToolStartedEvent class. ### Parameters #### Constructor Parameters - **streamParentMessageId** (String?) - Optional - The ID of the parent message for streaming. - **runId** (int?) - Optional - The ID of the run. - **threadId** (String?) - Optional - The ID of the thread. - **toolCallId** (String?) - Optional - The ID of the tool call. - **toolCallName** (String?) - Optional - The name of the tool call. - **displayName** (String?) - Optional - The display name of the tool. - **executionText** (String?) - Optional - The text describing the tool's execution. - **arguments** (String?) - Optional - The arguments passed to the tool. - **id** (int?) - Optional - The unique identifier for the event. - **type** (String?) - Optional - The type of the event. - **conversationId** (String?) - Optional - The ID of the conversation. - **parentId** (String?) - Optional - The ID of the parent event. - **additionalProperties** (Map?) - Optional - Additional properties for the event. ``` -------------------------------- ### login Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Logs in a user with UID and Auth Key. Primarily for testing purposes; use `loginWithAuthToken` for production. ```APIDOC ## login ### Description Use this function only for testing purpose. For production, use loginWithAuthToken. ### Method `login(String uid, String authKey, {required dynamic onSuccess(User user)?, required dynamic onError(CometChatException excep)?})` → Future ### Parameters - **uid** (String) - The user ID. - **authKey** (String) - The authentication key. - **onSuccess** (dynamic) - Callback function executed with the User object upon successful login. - **onError** (dynamic) - Callback function executed if an error occurs during login. ``` -------------------------------- ### getPage Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_blocked_users_request/BlockedUsersRequest/getPage.html Gets the current page number for pagination. ```APIDOC ## getPage Method ### Description Gets the current page number for pagination. ### Signature `int getPage()` ### Implementation ```dart int getPage() => _currentPage; ``` ``` -------------------------------- ### Basic onConnecting Implementation Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_connection_listener/ConnectionListener/onConnecting.html This is a basic implementation of the onConnecting method. It serves as a placeholder and does not contain any specific logic. ```dart void onConnecting() {} ``` -------------------------------- ### leaveGroup Source: https://pub.dev/documentation/cometchat_sdk/latest/main_cometchat/CometChat-class.html Leaves a group. Requires the group GUID and success/error callbacks. ```APIDOC ## leaveGroup ### Description Leaves a group. ### Method `leaveGroup(String guid, {required dynamic onSuccess(String returnResponse)?, required dynamic onError(CometChatException excep)?})` → Future ### Parameters - **guid** (String) - The unique identifier for the group to leave. - **onSuccess** (dynamic) - Callback function executed with a response message upon leaving the group. - **onError** (dynamic) - Callback function executed if an error occurs while leaving the group. ``` -------------------------------- ### Get Timezone Preference Source: https://pub.dev/documentation/cometchat_sdk/latest/notification_main_cometchat_notifications/CometChatNotifications-class.html Retrieves the timezone preference for the logged-in user. ```dart getTimezone({dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) Retrieves the timezone preference for the logged-in user. ``` -------------------------------- ### AIAssistantToolStartedEvent Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/AIAssistantToolStartedEvent-class.html Constructors for creating instances of AIAssistantToolStartedEvent. ```APIDOC ## Constructors AIAssistantToolStartedEvent({String? streamParentMessageId, int? runId, String? threadId, String? toolCallId, String? toolCallName, String? displayName, String? executionText, String? arguments, int? id, String? type, String? conversationId, String? parentId, Map? additionalProperties}) AIAssistantToolStartedEvent.fromMap(Map map) Creates an instance from a map. factory ``` -------------------------------- ### AppEntity Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/AppEntity-class.html Initializes a new instance of the AppEntity class. ```APIDOC ## Constructors AppEntity() ``` -------------------------------- ### runtimeType Property Source: https://pub.dev/documentation/cometchat_sdk/latest/handlers_event_handler/EventHandler-class.html Gets a representation of the runtime type of the EventHandler object. ```APIDOC ## runtimeType → Type ### Description A representation of the runtime type of the object. ### Property runtimeType ``` -------------------------------- ### CometChatException Constructors Source: https://pub.dev/documentation/cometchat_sdk/latest/exception_cometchat_exception/CometChatException-class.html Provides information on how to instantiate the CometChatException class. ```APIDOC ## Constructors ### CometChatException Creates a new CometChatException. #### Parameters - **code** (String) - Required - The error code associated with the exception. - **details** (String?) - Optional - Additional details about the exception. - **message** (String?) - Optional - A human-readable message describing the exception. ### CometChatException.fromMap Creates a CometChatException from a map. #### Parameters - **map** (dynamic) - Required - The map containing exception data. ``` -------------------------------- ### getUpdatedAfter Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_messages_request/MessagesRequest/getUpdatedAfter.html Gets the updated after timestamp. This method is available for Android. ```APIDOC ## getUpdatedAfter() ### Description Gets the updated after timestamp. ### Method Signature DateTime? getUpdatedAfter() ### Android Reference `MessagesRequest.getUpdatedAfter()` ### Implementation ```dart DateTime? getUpdatedAfter() => updatedAfter; ``` ``` -------------------------------- ### User Constructor Implementation Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/User/User.html This is the implementation of the User constructor. It initializes a new User instance with various properties, some of which are required. ```dart User({ this.uid = "", required this.name, this.avatar, this.link, this.role, this.status, this.statusMessage, this.lastActiveAt, this.tags, this.metadata, this.hasBlockedMe, this.blockedByMe, this.deactivatedAt, }); ``` -------------------------------- ### getUID Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_messages_request/MessagesRequest/getUID.html Gets the user ID. This method is available for Android. ```APIDOC ## getUID Method ### Description Gets the user ID. ### Method Signature `String? getUID()` ### Android Reference `MessagesRequest.getUID()` ### Implementation ```dart String? getUID() => uid; ``` ``` -------------------------------- ### FlagReason Methods Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/FlagReason-class.html Lists the available methods for interacting with FlagReason objects. ```APIDOC ## Methods noSuchMethod(Invocation invocation) → dynamic Invoked when a nonexistent method or property is accessed. inherited ttoJson() → Map Generates a map representing the FlagReason. toMatrix() → Map Generates a map representing the FlagReason. toString() → String Returns a string representation of the FlagReason instance. override ``` -------------------------------- ### getTags Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_groups_request/GroupsRequest/getTags.html Gets the list of tags used to filter groups. ```APIDOC ## getTags Method ### Description Gets the list of tags used to filter groups. ### Signature List? getTags() ### Implementation ```dart List? getTags() => tags; ``` ``` -------------------------------- ### Limit Property Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_banned_group_member_request/BannedGroupMembersRequestBuilder/limit.html Sets or gets the number of results to limit the query. ```APIDOC ## limit property ### Description Number of results to limit the query. ### Type `int?` ### Getter/Setter This property is a getter/setter pair. ``` -------------------------------- ### Get Muted Conversations Source: https://pub.dev/documentation/cometchat_sdk/latest/notification_main_cometchat_notifications/CometChatNotifications-class.html Retrieves a list of conversations that have been muted by the logged-in user. ```APIDOC ## getMutedConversations ### Description Retrieves a list of conversations that have been muted by the logged-in user. ### Method `Future> getMutedConversations({dynamic onSuccess(List mutedConversations)?, dynamic onError(CometChatException e)?})` ### Parameters - `onSuccess` (Function) - Optional callback function that is executed upon successful retrieval of the muted conversations list. - `onError` (Function) - Optional callback function that is executed if an error occurs during retrieval. ``` -------------------------------- ### Import Full SDK Source: https://pub.dev/documentation/cometchat_sdk/latest/ai Import the entire CometChat SDK if you need access to all its features, including the AI sub-package. ```dart import 'package:cometchat_sdk/cometchat_sdk.dart'; ``` -------------------------------- ### Get Muted Conversations Source: https://pub.dev/documentation/cometchat_sdk/latest/notification_main_cometchat_notifications/CometChatNotifications-class.html Retrieves a list of conversations that have been muted by the logged-in user. ```dart getMutedConversations({dynamic onSuccess(List mutedConversations)?, dynamic onError(CometChatException e)?}) Retrieves a list of conversations that have been muted by the logged-in user. ``` -------------------------------- ### FlagReason Constructor Source: https://pub.dev/documentation/cometchat_sdk/latest/cometchat_sdk/FlagReason/FlagReason.html Constructs a new FlagReason instance with the provided details. ```APIDOC ## FlagReason Constructor ### Description Constructs a new FlagReason instance. ### Parameters - **id** (String) - Required - Unique identifier for the flag reason. - **name** (String) - Required - The name of the flag reason. - **description** (String) - Optional - A detailed description of the flag reason. - **createdAt** (DateTime) - Optional - The timestamp when the flag reason was created. - **updatedAt** (DateTime) - Optional - The timestamp when the flag reason was last updated. ### Implementation ```dart FlagReason({ required this.id, required this.name, this.description, this.createdAt, this.updatedAt, }); ``` ``` -------------------------------- ### getUIDs Method Source: https://pub.dev/documentation/cometchat_sdk/latest/builders_users_request/UsersRequest/getUIDs.html Gets the list of UIDs used to fetch specific users. ```APIDOC ## getUIDs Method ### Description Gets the list of UIDs used to fetch specific users. ### Signature List? getUIDs() ### Implementation ```dart List? getUIDs() => uids; ``` ```