forceSync method

Future<void> forceSync()

Forces an immediate sync cycle outside the regular timer.

Useful when fresh data is needed immediately (e.g., navigating to a screen that requires data not yet synced via the periodic timer).

Behavior:

  • Does nothing if the strategy is not running
  • Does nothing if a sync is already in progress (waits for current cycle)
  • Reuses the same sync logic as the periodic timer

Implementation

Future<void> forceSync() async {
  if (!_isRunning) return;
  await _performSync();
}