pauseForLifecycle method

Future<void> pauseForLifecycle()

Temporarily pauses scanning when the app moves to the background.

Implementation

Future<void> pauseForLifecycle() async {
  if (_lifecyclePaused || _userPaused) return;

  _lifecyclePaused = true;
  _cancelTimers();
  await _scanner.stop();
  _notifyStateChanged();
}