sendStatus method

dynamic sendStatus()

Implementation

@pragma('vm:entry-point')
sendStatus() async {
  print('tamano de descarga: $downloadSize del total de $totalSize');
  mainStatus.porcent = (downloadSize * 100 / totalSize).clamp(0.0, 100.0);
  print(mainStatus.porcent);
  //cuando el porcentaje de descarga sea 100% se empezara a reducir el limite de envios al sendport y cuando llegue a 0 se lioberara el isolate para su nuevo uso
  if (mainStatus.complete &&
      limitSend >= 0 &&
      statusDownload.status == statusDownloadType.join) {
    mainStatus.porcent = 100;
    limitSend--;
  }
  if (limitSend == 0) {
    statusDownload.status = statusDownloadType.freeIsolate;
    sendPort.send(statusDownload);
    sendInterval.cancel();
  } else {
    sendPort.send(mainStatus);
  }
}