showProgress method

void showProgress(
  1. int current,
  2. int total
)

Implementation

void showProgress(int current, int total) {
  final percentage = (current / total * 100).round();
  final filled = (current / total * 20).round();
  final empty = 20 - filled;

  final bar = '█' * filled + '░' * empty;
  stdout.write(
    '\r$_green[$bar]$_reset $percentage% ($_cyan$current$_reset/$total)',
  );

  if (current == total) {
    print('');
  }
}