update method

dynamic update(
  1. dynamic newValue
)

Implementation

update(newValue) {
  var duration = DateTime.now().difference(start).inMilliseconds;
  ratio = newValue / duration;
  if (ratio > 0) {
    left = Duration(milliseconds: ((1 - newValue) / ratio).round());
    _remaining = ratio == 0
        ? "----"
        : "${left.inMinutes} mn ${(left.inSeconds % 60).toString().padLeft(2, '0')} s";
  }
  setState(() {
    _progress = newValue;
  });
}