How to use TimerTask on flutter?
553
import 'dart:async'; // import this
And use Timer
class periodic
named constructor.
Timer.periodic(Duration(seconds: 1), (timer) {
// this block runs every second
// and when you want to stop it, simply call `timer.cancel();` here
});
Author by
Gerard_jcr
Updated on December 18, 2022Comments
-
Gerard_jcr over 1 year
I want to create a function that runs every x seconds ..
in java there is the
TimerTask
but in flutter what is it?