startInterval method
Starts a periodic interval timer.
id: A unique identifier (required for cancellation).duration: The interval between executions.callback: The function to execute.
Replaces Timer.periodic. Automatically cancelled on controller close.
Implementation
void startInterval(
String id, Duration duration, void Function(Timer timer) callback) {
_timers[id]?.cancel();
_timers[id] = Timer.periodic(duration, callback);
}