selectOrRemoveChatfromList method

dynamic selectOrRemoveChatfromList(
  1. int index
)

Implementation

selectOrRemoveChatfromList(int index) {
  if (selected.isTrue) {
    if (selectedChats.contains(recentChats[index].jid)) {
      selectedChats.remove(recentChats[index].jid.checkNull());
      selectedChatsPosition.remove(index);
    } else {
      selectedChats.add(recentChats[index].jid.checkNull());
      selectedChatsPosition.add(index);
    }
  }
  if (selectedChats.isEmpty) {
    clearAllChatSelection();
  } else {
    menuValidationForItem();
  }
}