isInDownloadQueue static method

bool isInDownloadQueue({
  1. required DownloadMessageQueueData data,
})

Implementation

static bool isInDownloadQueue({
  required DownloadMessageQueueData data,
}) {
  bool res = false;
  if (downloadQueue.containsKey(data.convID)) {
    if (downloadQueue[data.convID] != null) {
      List<DownloadMessageQueueData> queueData = downloadQueue[data.convID]!;
      if (queueData != null && queueData.isNotEmpty) {
        console(downloadQueue[data.convID]!.first.getUniqueueKey());
      }

      if (downloadQueue[data.convID]!.indexWhere((ele) => ele.getUniqueueKey() == data.getUniqueueKey()) > -1) {
        res = true;
      }
    }
  }
  console("${data.convID} ${data.getUniqueueKey()} is in download queue: $res");
  return res;
}