var counter = 3;
Timer.periodic(const Duration(seconds: 1), (timer) {
 print(timer.tick);
   counter--;
   if (counter == 0) {
     print(counter);

timer.cancel();
}
});