markAsUnread static method

Future<void> markAsUnread(
  1. BaseMessage baseMessage, {
  2. required dynamic onSuccess(
    1. String
    )?,
  3. required dynamic onError(
    1. CometChatException excep
    )?,
})

Marks a BaseMessage as unread.

The markAsUnread function takes in a BaseMessage object, which represents the message you want to mark as unread.

Implementation

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