showProgress static method

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

Simple manual progress bar display

Implementation

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

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

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