markConversationAsDelivered static method

Future<String?> markConversationAsDelivered(
  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 delivered.

conversationWithId The UID of the user or GUID of the group whose conversation messages are to be marked as delivered. 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?> markConversationAsDelivered(
    String conversationWithId, String conversationType,
    {required Function(String message)? onSuccess,
      required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('markConversationAsDelivered', {
      '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;
}