markConversationAsRead static method

Future<String?> markConversationAsRead(
  1. String conversationWithId,
  2. String conversationType, {
  3. required dynamic onSuccess(
    1. String message
    )?,
  4. required dynamic onError(
    1. CometChatException excep
    )?,
})

Marks all messages in a conversation as read.

conversationWithId The UID of the user or GUID of the group whose conversation messages are to be marked as read. conversationType The type of conversation - 'user' or 'group'.

Returns a success message on success.

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<String?> markConversationAsRead(
    String conversationWithId, String conversationType,
    {required Function(String message)? onSuccess,
      required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('markConversationAsRead', {
      'conversationWithId': conversationWithId,
      'conversationType': conversationType,
    });
    if (onSuccess != null) onSuccess(result);
    return result;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}