sendMessage method
void
sendMessage(
- NIMMessage message, {
- NIMMessage? replyMsg,
- bool resend = false,
})
Implementation
void sendMessage(NIMMessage message,
{NIMMessage? replyMsg, bool resend = false}) async {
message.messageAck = await ConfigRepo.getShowReadStatus();
var chatMessage = ChatMessage(message, replyMsg: replyMsg);
if (resend == false) {
_messageList.add(chatMessage);
notifyListeners();
} else {
_onMessageSending(chatMessage);
}
if (replyMsg != null) {
ChatMessageRepo.replyMessage(
msg: message, replyMsg: replyMsg, resend: resend)
.then((value) {
_onMessageSend(value, chatMessage);
});
} else {
ChatMessageRepo.sendMessage(message: message, resend: resend)
.then((value) {
_onMessageSend(value, chatMessage);
});
}
}