setInterval method
duration
is the amount of time that Flute will wait to call
the function again, it will continiously work.
Returns a function that can stop the interval.
Example
final stopInterval = Flute.setInterval(5, () {
debugPrint('I will run every 5 seconds');
});
Flute.setTimeout(20, stopInterval);
Implementation
Function setInterval(Duration duration, VoidFunction callback) {
final timer = Timer.periodic(duration, (_) => callback());
return timer.cancel;
}