stop method

void stop()

Stops the periodic synchronization timer.

This method:

  1. Cancels the periodic sync timer
  2. Reports disconnected state to the client
  3. Stops any ongoing sync (waits for current cycle to complete)

Usage:

periodicStrategy.stop(); // Stop syncing

Behavior:

  • Idempotent: calling multiple times has no effect if already stopped
  • Does not clear pending events: they remain in local storage
  • Current sync cycle completes before stopping

After stopping, you can restart with start.

Implementation

void stop() {
  LocalFirstLogger.log('Stopping periodic sync strategy', name: logTag);

  _isRunning = false;
  _syncTimer?.cancel();
  _syncTimer = null;

  reportConnectionState(false);
}