markFeedItemsAsDelivered static method
Future<void>
markFeedItemsAsDelivered(
- List<
NotificationFeedItem> feedItems, { - required dynamic onSuccess(
- void result
- required dynamic onError(
- CometChatException excep
Marks multiple NotificationFeedItems as delivered (batch).
Android Reference: CometChat.markFeedItemsAsDelivered(List<NotificationFeedItem>)
This operation is idempotent — calling multiple times has no side effects.
Delegates to NotificationFeedRepository.markDelivered for each item.
@param feedItems The list of NotificationFeedItems to mark as delivered. @param onSuccess Callback invoked on successful delivery marking. @param onError Callback invoked if an error occurs.
Implementation
static Future<void> markFeedItemsAsDelivered(
List<NotificationFeedItem> feedItems,
{required Function(void result)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final sdk = SdkRegistry.getInstance();
for (final feedItem in feedItems) {
await sdk.notificationFeed.markDelivered(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);
}
}