getNotificationFeedUnreadCount static method
Future<int?>
getNotificationFeedUnreadCount({
- required dynamic onSuccess(
- int count
- required dynamic onError(
- CometChatException excep
Gets the unread count for the notification feed.
Android Reference: CometChat.getNotificationFeedUnreadCount()
Returns the total number of unread notification feed items.
@param onSuccess Callback invoked with the unread count on success. @param onError Callback invoked if an error occurs.
Implementation
static Future<int?> getNotificationFeedUnreadCount(
{required Function(int count)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final sdk = SdkRegistry.getInstance();
final count = await sdk.notificationFeed.getUnreadCount();
if (onSuccess != null) onSuccess(count);
return count;
} on SdkException catch (sdkEx) {
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;
}