arm static method

void arm(
  1. Duration timeout, {
  2. required String reason,
})

Arms the watchdog: a heartbeat must arrive within timeout, every time, or restart runs. A startup arm is a boot, and a boot that is the fourth in five minutes is a loop, reported rather than restarted.

Implementation

static void arm(Duration timeout, {required String reason}) {
  if (reason == 'startup') {
    recordRestart(DateTime.now());
    if (restartLoopDetected(within: const Duration(minutes: 5), more: 3)) {
      const String finding = 'DV-KIOSK-008: restarted more than three times in five minutes; '
          'holding at the diagnostics screen instead of restarting again.';
      debugPrint('[dartvel] $finding');
      onRestartLoop?.call(finding);
      return;
    }
  }
  _watchdogTimeout = timeout;
  _rearm();
}