setTypingIndicator method
Implementation
@override
setTypingIndicator(
TypingIndicator typingIndicator, bool isTypingStarted) async {
int matchingIndex;
if (typingIndicator.receiverType == ReceiverTypeConstants.user) {
matchingIndex = list.indexWhere((Conversation conversation) =>
(conversation.conversationType == ReceiverTypeConstants.user &&
(conversation.conversationWith as User).uid ==
typingIndicator.sender.uid));
} else {
matchingIndex = list.indexWhere((Conversation conversation) =>
(conversation.conversationType == ReceiverTypeConstants.group &&
(conversation.conversationWith as Group).guid ==
typingIndicator.receiverId));
}
if (matchingIndex != -1) {
if (isTypingStarted == true) {
typingMap[list[matchingIndex].conversationId!] = typingIndicator;
} else {
if (typingMap.containsKey(list[matchingIndex].conversationId!)) {
typingMap.remove(list[matchingIndex].conversationId!);
}
}
update();
}
}