how to use timer.cancel() ? and it not work
liuchuancong opened this issue · comments
setState(() {
tweenIndex = (tweenIndex + 1) % colors.length;
});
});
and I add this code
floatingActionButton: FloatingActionButton(
child: Icon(Icons.refresh),
onPressed: (){
timer.cancel();
},
),
i try to cancel timer but it not work
https://stackoverflow.com/questions/49087537/how-to-make-timer-periodic-cancel-itself-when-a-condition-is-reached
i found answer but i try it,but fail