reliable_interval_timer 1.0.2 reliable_interval_timer: ^1.0.2 copied to clipboard
A timer that produces ticks within a given interval, accurate to the millisecond.
example/reliable_interval_timer_example.dart
import 'package:reliable_interval_timer/reliable_interval_timer.dart';
const intervalInMilliseconds = 250;
int ticks = 0;
void main() {
var timer = ReliableIntervalTimer(
interval: Duration(milliseconds: intervalInMilliseconds),
callback: onTimerTick,
);
timer.start().then((_) {
print('Timer started');
});
}
void onTimerTick(int elapsedMilliseconds) {
ticks++;
print('Tick #$ticks after $elapsedMilliseconds');
}
copied to clipboard