update method

dynamic update(
  1. num ratio

"update" the progress bar to represent an exact percentage. The ratio (between 0 and 1) specified will be multiplied by total and floored, representing the closest available "tick." For example, if a progress bar has a length of 3 and update(0.5) is called, the progress will be set to 1.

A ratio of 0.5 will attempt to set the progress to halfway.


update(num ratio) {
  var goal = (ratio * this.total).floor();
  var delta = goal - this.curr;
  this.tick(len: delta);