run method
void
run()
启动倒计时
Implementation
void run() {
if (isActive || periodic <= 0 || totalTime <= 0) return;
Duration duration = Duration(milliseconds: periodic);
_runCallback(totalTime);
timer = Timer.periodic(duration, (Timer timer) {
totalTime -= periodic;
if (totalTime >= periodic) {
_runCallback(totalTime);
} else if (totalTime == 0) {
_runCallback(totalTime);
} else {
cancel();
}
});
}