sendMessage method

  1. @override
Future<V2TimValueCallback<V2TimMessage>> sendMessage({
  1. required String id,
  2. required String receiver,
  3. required String groupID,
  4. MessagePriorityEnum priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL,
  5. bool onlineUserOnly = false,
  6. bool isExcludedFromUnreadCount = false,
  7. bool needReadReceipt = false,
  8. OfflinePushInfo? offlinePushInfo,
  9. String? cloudCustomData,
  10. 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;
}