markAsUnread static method
- BaseMessage baseMessage,
- {required dynamic onSuccess( )?,
- required dynamic onError(
- 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 (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()));
}
}