TimerComponent constructor

TimerComponent({
  1. required double period,
  2. bool repeat = false,
  3. bool autoStart = true,
  4. bool removeOnFinish = false,
  5. VoidCallback? onTick,
  6. ComponentKey? key,
})

Creates a TimerComponent

period The period of time in seconds that the tick will be called repeat When true, this will continue running after period is reached autoStart When true, will start upon instantiation (default is true) onTick When provided, will be called every time period is reached. This overrides the onTick method

Implementation

TimerComponent({
  required double period,
  bool repeat = false,
  bool autoStart = true,
  this.removeOnFinish = false,
  VoidCallback? onTick,
  super.key,
}) : _onTick = onTick {
  timer = Timer(
    period,
    repeat: repeat,
    onTick: this.onTick,
    autoStart: autoStart,
  );
}