getProgress method

double getProgress()

上传的进度, 范围为 0.0 - 1.0

Implementation

double getProgress() {
  if (totalBlockCount == 0) {
    return 0.0;
  }
  // 文件块的总数量
  final blockSize = PanUtils.getBlockSize(memberLevel);

  // 获取已上传的文件块数量,并计算总上传的字节数
  final totalUploadBytes = blockSize * uploadCount;

  final progress = totalUploadBytes / fileTotalSize;

  if (progress > 1.0) {
    return 1.0;
  }

  return progress;
}