【发布时间】:2021-09-08 04:38:57
【问题描述】:
void main() {
final newTi = Get.put(NewTimer());
...
...
...: Obx((){
return Text('${newTi.count}');
// I'm trying to set a new timer and watch each of them.
// It's just 10. What should I do?
}),
}
//
//
class NewTimer extends GetxController {
RxInt count = 10.obs;
}
//
//
class TimerFunc extends GetxController {
void timeRun() {
NewTimer newTime = new NewTimer();
Timer.periodic(Duration(seconds: 1), (t) {
if (t.tick == 10) {
t.cancel();
} else {
newTime.count--;
}
});
}
}
我正在尝试设置一个新计时器并观察它们中的每一个。 才10点。我该怎么办?
.......................
【问题讨论】:
标签: flutter timer flutter-getx