showProgress static method

void showProgress(
  1. int current,
  2. int total,
  3. String currentFile
)

Show progress during file processing

Implementation

static void showProgress(int current, int total, String currentFile) {
  final percent = (current / total * 100).toStringAsFixed(0);
  final bar = _makeProgressBar(current, total, 30);

  // Use carriage return to overwrite the line
  stdout.write('\r[$bar] $percent% ($current/$total) $currentFile'.padRight(100));

  // If complete, move to next line
  if (current == total) {
    print('');
  }
}