itemsRead method

dynamic itemsRead()

Implementation

itemsRead() async {
  if (await AppUtils.isNetConnected()) {
    selected(false);
    Mirrorfly.markConversationAsRead(jidList: selectedChats);
    var count = selectedChatsPosition.length;
    for (var element in selectedChatsPosition) {
      recentChats[element].isConversationUnRead = false;
      recentChats[element].unreadMessageCount = 0;
      var jid = recentChats[element].jid;
      NotificationBuilder.clearConversationOnNotification(jid.checkNull());
    }
    clearAllChatSelection();
    updateUnReadChatCount();
    // toToast("Chat${count > 1 ? 's' : ''} marked as read");
    if (count > 1) {
      toToast(AppConstants.chatsMarkedAsRead);
    } else {
      toToast(AppConstants.chatMarkedAsRead);
    }
  } else {
    toToast(AppConstants.noInternetConnection);
  }
}