【发布时间】:2021-12-15 13:27:24
【问题描述】:
我怎样才能让它工作?
@override
void dispose() {
timer.cancel();
super.dispose();
}
这就是我所拥有的:
class _ListCell extends State<ListCell> {
@override
void initState() {
super.initState();
Timer timer = Timer.periodic(Duration(seconds: 1), (_) => ListCell());
}
不断收到错误:
Error: The getter 'timer' isn't defined for the class '_ListCell'.
【问题讨论】: