我正在使用下面的代码来启动计时器
定时器片段:
_increamentCounter() {
Timer.periodic(Duration(seconds: 2), (timer) {
setState(() {
_counter++;
});
});
}
RaisedButton raisedButton =
new RaisedButton(child: new Text("Button"), onPressed: () {
_increamentCounter();
});
我想要的是在特定(N)定时器间隔后停止这个定时器。