sendTextMessageWithMessageAck static method

Future<NIMResult<NIMMessage>> sendTextMessageWithMessageAck({
  1. required String sessionId,
  2. required NIMSessionType sessionType,
  3. required String text,
})

发送文本消息 自动设置是否需要已读回执

Implementation

static Future<NIMResult<NIMMessage>> sendTextMessageWithMessageAck(
    {required String sessionId,
    required NIMSessionType sessionType,
    required String text}) async {
  var msgBuilder = await MessageBuilder.createTextMessage(
      sessionId: sessionId, sessionType: sessionType, text: text);
  if (msgBuilder.isSuccess && msgBuilder.data != null) {
    msgBuilder.data!.messageAck = await ConfigRepo.getShowReadStatus();
    return sendMessage(message: msgBuilder.data!);
  } else {
    return NIMResult.failure(message: msgBuilder.errorDetails);
  }
}