Create an init state method on the page with the timer and call your function there - this runs when the page is initialised
class TimerPage extends StatefulWidget {
@override
_TimerPageState createState() => _TimerPageState();
}
class _TimerPageState extends State<TimerPage> {
.
.
.
@override
void initState() {
super.initState();
_startTimer();
}
.
.
.
}
As said in the comments, add your code in the body of your question - this will allow us to give a more complete answer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…