progressBar static method

void progressBar(
  1. String label,
  2. int percent, {
  3. String status = '',
})

Renders inline: ██████░░░░ 60% BUILDING

Implementation

static void progressBar(String label, int percent, {String status = ''}) {
  final barW = 24;
  final filled = (barW * percent / 100).round();
  final empty = barW - filled;
  final bar = '$_gr${'█' * filled}$_gy${'░' * empty}$_r';
  stdout.write('\r  $bar  $_cy$_b$percent%$_r  $_ye$status$_r   ');
  if (percent >= 100) print('');
}