markAsDelivered static method
dynamic
markAsDelivered(
- BaseMessage message, {
- required dynamic onSuccess(
- String message
- required dynamic onError(
- 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 (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()));
}
}