markFeedItemAsRead static method
Future<void>
markFeedItemAsRead(
- NotificationFeedItem feedItem, {
- required dynamic onSuccess(
- void result
- required dynamic onError(
- CometChatException excep
Marks a single NotificationFeedItem as read.
Android Reference: CometChat.markFeedItemAsRead(NotificationFeedItem)
This operation is idempotent — calling multiple times has no side effects.
Delegates to NotificationFeedRepository.markRead.
@param feedItem The NotificationFeedItem to mark as read. @param onSuccess Callback invoked on successful read marking. @param onError Callback invoked if an error occurs.
Implementation
static Future<void> markFeedItemAsRead(NotificationFeedItem feedItem,
{required Function(void result)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final sdk = SdkRegistry.getInstance();
await sdk.notificationFeed.markRead(feedItem.id);
if (onSuccess != null) onSuccess(null);
} 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);
}
}