markAsInteracted static method

Future<void> markAsInteracted(
  1. int messageId,
  2. String interactedElementId,
  3. {required dynamic onSuccess(
    1. String
    )?,
  4. required dynamic onError(
    1. CometChatException excep
    )?}
)

Messages elements can be marked as interacted.

messageId The ID of the message above which all messages for a particular conversation are to be marked as read.

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<void> markAsInteracted(int messageId, String interactedElementId ,{required Function(String)? onSuccess, required Function(CometChatException excep)? onError}) async {
  try {

    final result = await channel.invokeMethod('markAsInteracted', {
      'messageId': messageId,
      "interactedElementId": interactedElementId
    });
    if(onSuccess != null) onSuccess(result);
  } on PlatformException catch (platformException) {
    if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
  } catch (e) {
    debugPrint("Error: $e");
    if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
  }
}