In Android, we have Handler.post() method which can run after every fixed time interval like this.
Handler handler = new Handler();
handler.post(new Runnable() {
public void run() {
// ... this runs after every second
handler.postDelayed(this, 1000); // makes run() run after every 1000 ms
}
}
Do we have anything similar in Dart or Flutter?
PS: The similar of Handler.postDelayed() is Future.delayed(). I am asking for Handler.post()
I found that. Timer.periodic() is the one I should be using.
Timer.periodic(Duration(microseconds: 1000), (_) {
// Runs after every 1000ms
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With