sendMessageToDirectChat method
Future<void> sendMessageToDirectChat (String chatId, String messageContent)
This function send the message to Direct Chat.
params:
chatId
: id of a chat where message need to be send.messageContent
: content of a message.
Implementation
Future<void> sendMessageToDirectChat(
String chatId,
String messageContent,
) async {
chatState = ChatState.loading;
_chatService.chatMessagesStream.listen((newMessage) {
_chatMessagesByUser[chatId]!.add(newMessage);
});
await _chatService.sendMessageToDirectChat(chatId, messageContent);
chatState = ChatState.complete;
}