markAsDelivered static method

dynamic markAsDelivered(
  1. BaseMessage message, {
  2. required dynamic onSuccess(
    1. String message
    )?,
  3. required dynamic onError(
    1. CometChatException excep
    )?,
})

Mark the messages for a particular conversation as delivered .

method could throw PlatformException with error codes specifying the cause

Implementation

static markAsDelivered(BaseMessage message,
    {required Function(String message)? onSuccess,
    required Function(CometChatException excep)? onError}) async {
  try {
    Map<String, dynamic> messageMap = message.toJson();
    final result = await channel
        .invokeMethod('markAsDelivered', {'baseMessage': messageMap});
    if (onSuccess != null) onSuccess(result);
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}