ProgressBar constructor

ProgressBar(
  1. String format, {
  2. int total = 0,
  3. int width = 0,
  4. bool clear = false,
  5. String completeChar = '=',
  6. String incompleteChar = '-',
  7. Function? callback,
})

Initialize a ProgressBar with the given format string and the options map.

Format tokens:

  • :bar the progress bar itself
  • :current current tick number
  • :total total ticks
  • :elapsed time elapsed in seconds
  • :percent completion percentage
  • :eta eta in seconds

Options:

  • total total number of ticks to complete
  • width the displayed width of the progress bar defaulting to total
  • completeChar completion character defaulting to "="
  • incompleteChar incomplete character defaulting to "-"
  • callback optional function to call when the progress bar completes
  • clear will clear the progress bar upon termination

Implementation

ProgressBar(
  this.format, {
  this.total = 0,
  this.width = 0,
  this.clear = false,
  this.completeChar = '=',
  this.incompleteChar = '-',
  this.callback,
}) {
  if (width <= 0 && total > 0) {
    width = total;
  }
}