CometChatNotifications class
Provides notification management functionality for CometChat.
Android Reference: com.cometchat.chat.core.CometChatNotifications
This class provides static methods for:
- Fetching, updating, and resetting notification preferences
- Managing muted conversations
- Registering and unregistering push notification tokens
- Managing timezone preferences
Example:
// Fetch notification preferences
final prefs = await CometChatNotifications.fetchPreferences();
// Register push token
await CometChatNotifications.registerPushToken(
PushPlatforms.FCM_FLUTTER_ANDROID,
fcmToken: 'your_fcm_token',
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fetchPreferences(
{dynamic onSuccess(NotificationPreferences notificationPreferences)?, dynamic onError(CometChatException e)?}) → Future< NotificationPreferences?> - Retrieves the current notification preferences for the logged-in user.
-
getMutedConversations(
{dynamic onSuccess(List< MutedConversation> mutedConversations)?, dynamic onError(CometChatException e)?}) → Future<List< MutedConversation> > - Retrieves a list of conversations that have been muted by the logged-in user.
-
getTimezone(
{dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future< String?> - Retrieves the timezone preference for the logged-in user.
-
muteConversations(
List< MutedConversation> muteConversations, {dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future<String?> - Mutes the specified conversations for the logged-in user.
-
registerPushToken(
PushPlatforms pushPlatforms, {String? fcmToken, String? deviceToken, String? voipToken, String? providerId, dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future< String?> - Registers a push notification token with the CometChat server for the current user.
-
resetPreferences(
{dynamic onSuccess(NotificationPreferences notificationPreferences)?, dynamic onError(CometChatException e)?}) → Future< NotificationPreferences?> - Resets notification preferences to their default values for the logged-in user.
-
unmuteConversations(
List< UnmutedConversation> unmutedConversations, {dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future<String?> - Unmutes the specified conversations for the logged-in user.
-
unregisterPushToken(
{dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future< String?> - Unregisters the push notification token for the logged-in user.
-
updatePreferences(
NotificationPreferences notificationPreferences, {dynamic onSuccess(NotificationPreferences notificationPreferences)?, dynamic onError(CometChatException e)?}) → Future< NotificationPreferences?> - Updates the notification preferences for the logged-in user.
-
updateTimezone(
String timezone, {dynamic onSuccess(String response)?, dynamic onError(CometChatException e)?}) → Future< String?> - Updates the timezone preference for the logged-in user.