start method

void start()

Implementation

void start() {
  if (_running) return;
  _running = true;
  _timer = Timer.periodic(const Duration(seconds: 1), (_) {
    if (_remaining.inSeconds <= 0) {
      _timer?.cancel();
      _running = false;
      widget.onFinished?.call();
      setState(() {});
      return;
    }
    setState(() => _remaining -= const Duration(seconds: 1));
    widget.onTick?.call(_remaining);
  });
}