subtract method

void subtract(
  1. Duration duration, {
  2. bool start = false,
  3. Duration changeAnimationDuration = const Duration(seconds: 0),
})

This increases the length of time elapsed by the specified duration duration.

This doesn't override the initial SimpleTimer widget duration. The specified duration is used to calculate the start value

The start value sets whether or not start the timer after the value change (defaults to false).

The animationDuration value sets the length of time used to animate from the previous value to the new value

Implementation

void subtract(Duration duration, {bool start = false, Duration changeAnimationDuration = const Duration(seconds: 0)}) {
  duration = (duration > this.duration!) ? this.duration! : duration;
  double newValue = this.value + (duration.inMilliseconds / this.duration!.inMilliseconds);
  this.animateTo(newValue, duration: changeAnimationDuration);
  if (start) {
    this.forward();
  }
}