sendMessage method
Future<V2TimValueCallback<V2TimMessage> >
sendMessage({
- required String id,
- required String receiver,
- required String groupID,
- MessagePriorityEnum priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL,
- bool onlineUserOnly = false,
- bool isExcludedFromUnreadCount = false,
- bool needReadReceipt = false,
- OfflinePushInfo? offlinePushInfo,
- String? cloudCustomData,
- String? localCustomData,
override
Implementation
@override
Future<V2TimValueCallback<V2TimMessage>> sendMessage({
required String id, // 自己创建的ID
required String receiver,
required String groupID,
MessagePriorityEnum priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL,
bool onlineUserOnly = false,
bool isExcludedFromUnreadCount = false,
bool needReadReceipt = false,
OfflinePushInfo? offlinePushInfo,
String? cloudCustomData,
String? localCustomData,
}) async {
final result =
await TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(
id: id,
receiver: receiver,
groupID: groupID,
priority: priority,
onlineUserOnly: onlineUserOnly,
offlinePushInfo: offlinePushInfo,
needReadReceipt: needReadReceipt,
localCustomData: localCustomData,
cloudCustomData: cloudCustomData,
);
if (result.code != 0) {
String recommendText = ErrorMessageConverter.getErrorMessage(result.code);
_coreService.callOnCallback(TIMCallback(
type: TIMCallbackType.API_ERROR,
errorMsg: result.desc,
errorCode: result.code,
infoRecommendText: recommendText));
}
return result;
}