triggerBackgroundCheck static method

void triggerBackgroundCheck(
  1. List<String> args
)

Implementation

static void triggerBackgroundCheck(List<String> args) {
  // Avoid running check recursively or during upgrade
  if (args.isNotEmpty &&
      (args.first == '_check_update' || args.first == 'upgrade')) {
    return;
  }

  final cache = readCache();
  final now = DateTime.now();

  if (cache == null ||
      now.difference(cache.lastChecked) > const Duration(hours: 24)) {
    _spawnBackgroundProcess();
  }
}