showBytes static method

void showBytes(
  1. FetchProgress progress
)

Shows the progress by replacing the console existing line with the message:

Where XX is the bytes downloaded and YY is the total bytes to download.

 fetch(
     url:
         'https://some/resource/file.zip',
    saveToPath: pathToPiImage,
    fetchProgress: FetchProgress.showBytes
        });

Implementation

static void showBytes(FetchProgress progress) {
  final update = formatByteLine(progress);
  if (update.newline) {
    print('\n${update.value}');
  } else {
    Terminal()
      ..column = update.offset
      ..write(update.value);
  }
}