getMessageReceipts static method
Future<List<MessageReceipt> ?>
getMessageReceipts(
- int messageId, {
- required dynamic onSuccess(
- List<
MessageReceipt> messageReceipt
- List<
- required dynamic onError(
- CometChatException excep
Method to get message receipts.
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<List<MessageReceipt>?> getMessageReceipts(int messageId,
{required Function(List<MessageReceipt> messageReceipt)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
List<MessageReceipt> receiptList = [];
final result =
await channel.invokeMethod('getMessageReceipts', {'id': messageId});
for (var _obj in result) {
try {
receiptList.add(MessageReceipt.fromMap(_obj));
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
return [];
}
}
if (onSuccess != null) onSuccess(receiptList);
return receiptList;
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
return null;
}